{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 3: Symbolic computing"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Robert Johansson\n",
    "\n",
    "Source code listings for [Numerical Python - Scientific Computing and Data Science Applications with Numpy, SciPy and Matplotlib](https://www.apress.com/us/book/9781484242452) (ISBN 978-1-484242-45-2)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import sympy"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "sympy.init_printing()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy import I, pi, oo"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "x = sympy.Symbol(\"x\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "y = sympy.Symbol(\"y\", real=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y.is_real"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x.is_real is None"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.Symbol(\"z\", imaginary=True).is_real"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "x = sympy.Symbol(\"x\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "y = sympy.Symbol(\"y\", positive=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAACsAAAAdCAYAAAAzfpVwAAAABHNCSVQICAgIfAhkiAAAAgdJREFUWIXt102ITlEcx/HPDMnLTEmZyMvGJCGTsDCN0pMVzSwmFlbExsLWgg0rBk1KGRI1K5lslI1kYTNFoyhFLCSboSlEUd7G4hx53Odl7r1zH2PxfOvWc+45v3O+/c+5t/vQpDG05MwtxPsiRRrJPuyZaYm0XEP7v160NUdmTrw+FewyJXlkS7hXsEfDuICVM7FwnsquwOsC1j6KMXzEBG5hfb1AVtmNeJxLrZLtGEK3cLS+4y4WFTS/49hS1GQJ2vADvbUGZK3sJjycjlEd2gWfd0VMtgyXipioBiN4hFlZQrWqfQi7pmtUg7MYR2eWUC+eqy58A3PrZO9gEv2J+y0Yjn0DVXKDeIu1WUQ3x+BP9CT6FuD6FPku4QF56u+tHIyil6tkzucRLWcUZxL3+nEgRXY4iu2P7WOxPaJyt4aEd2wJS8qutiyyR4SjUM5VdKTILscXvMLhKHpb+JZIMlnjOpFFdnUMrYntVtzMkD9VtvAo5mdZvB7VHqQXQmX7YnsrHmSYc6Ls90F8zqeWntNCVX7/Xpcyt1d4QMeFyl4sXq2SbuHJ7hA+MNKwE1/xBIvxDN/8OU4No1V4pZzEuRTje4Ttfoml8d5uobpZznturgiVKk0xrgsfhK1flegbE4S3FW6XoE/4Bzu7zphOvInjNlTp3yHI3i/cLsE84QO5SZP/iV/MOmSLY+JKjAAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle \\sqrt{x^{2}}$"
      ],
      "text/plain": [
       "   ____\n",
       "  ╱  2 \n",
       "╲╱  x  "
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.sqrt(x ** 2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAA8AAAATCAYAAABPwleqAAAABHNCSVQICAgIfAhkiAAAAOFJREFUOI3d0q9KQwEUx/GPgkXD0DjEuiXBMLT4BMsrBtPwBRZmshsFEYZvoM0oFgUNy/oCmsQgYyhMplvYGVzH3bwXlvyVw/nzPedwOMxJDQzCpqmEHu7SktsBX06Br9HHZlpyCZ94TsnVovHJlMbgNoqKidgKXvCKQrJ4cQK+D7uTiB1hHU10Zk2uxuTj8Mv4wgMWZoGwip9YH27wja2/wLGe8IG92OIsKwitgLp4w1oeeD/gAep5QNgNsC3DkSZ1ZXSkSl5wfKTTrMAGDnFu9PiPWM4KH8S0d1z4/Zr/UUPpLy9/oykWBAAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle y$"
      ],
      "text/plain": [
       "y"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.sqrt(y ** 2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "n1, n2, n3 = sympy.Symbol(\"n\"), sympy.Symbol(\"n\", integer=True), sympy.Symbol(\"n\", odd=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAEsAAAAVCAYAAAAOyhNtAAAABHNCSVQICAgIfAhkiAAAA/pJREFUWIXt2FuIVlUUB/CfWl5SsdKisAuEVpQPjoYZWPRgUARREFYvQZbRhR6yEOxGkBlZ0VPZnZIwK6VMihJCuxDmJS0No6Iw0skpZMQwtdHpYe3DnNmzj1mkI+EfhvV9a+291tp7r9s3HMH/A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/RsKP3FxX5e0LNOPOYxGf8aMYLsxN2JV/334NmGc25Mvpd+xQwTA+zbDXsPK8wUB235u4UHCXdoHlYPOwwUI8KSXrA9SGTTwlzQr+fawwIdovAOEDWtNPkfLIwWNXuO5o5+BEfwH+IvrycOrw55rUIAAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle \\cos{\\left(\\pi n \\right)}$"
      ],
      "text/plain": [
       "cos(π⋅n)"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.cos(n1 * pi)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAADgAAAAWCAYAAACVIF9YAAAABHNCSVQICAgIfAhkiAAAAilJREFUWIXt10+ITlEYx/GPMTHTTFFjQSRpxlgZE4kF+TNYmmKvWNvIhoXY2looK0miTP6tSI0/CRGzs2AySkZD/k/In7E45811ve/MvXPvpJhv3Z73Puec5/yec597zn35TzmOITT9ZR3LMIKdNdoXxPZuXMIw+rF+tKDL8QO7y1KZYBsO4wbeR3EnxhhzFoNortK2Jca4hi604gIejBbwMt6iMYfwrPRFQR/wULYEV8R++6q07RcWak7Ctx3PagVbJDy9o5kl52Md2jAFa2VLkLAYTzE15e/ByZTvIK5WbupSjTvi5KczCs5LLx4JieXhFOYLZZikA7dSvk6JEk0n2IXvuJ1TwERzM9qNCV8zFvrzfauZYBOWCuUwXL7GQtyNdk3Ct0SohL6ErwXz1EhwrlDjgxOjsRDv8Fko0wodQrl/TPg68UV4SPg9wZZo39SYZEBYsaxXls0jD68xK3F/BItTfa6gAd8qjvpE46doG2pM0C+sYlae5+ibhUa/NGYmmeBQtC3VOmJD3uAlUoeZeDKegRUG8RLtJYkqk3bh+Oobq2OaZIIjuC7UeWs5ukpjZbS9eQfWp+57sBWb8bigqGp0xwtmR7sKx+LvV9hTZdwm4Xw+X1TANLzAnaKBanDA6DvvQJUxM4TN5VxZIvbGyTrLCliQXYKe1WUFbBA+bC+WFbAAjcJxc2a8AdJf54RD8j6m4x6+jjd4CbQJXyaHhL9wk0zyr/ET8eJ83jR24XMAAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle \\left(-1\\right)^{n}$"
      ],
      "text/plain": [
       "    n\n",
       "(-1) "
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.cos(n2 * pi)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAB4AAAASCAYAAABM8m7ZAAAABHNCSVQICAgIfAhkiAAAAJVJREFUSInt1KENAjEUh/Ef5IZgAYbAcWEBBKMwADuwwAn2QLAADkVyCoUCgwNBFaLpXUpDyH3JSyte+4n+X/kTVtjigBue2JUQH4PsjlNJcY0pRpjHxFVm8T61cZxZnMwgbr0DkVq9E/sZrjMeHc5fcokXfS/qys+8cTFyfyDLUDAJ6wxN2F+xzuwEG/EpaL8hHYjyAqjXJ2KDRzE8AAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle -1$"
      ],
      "text/plain": [
       "-1"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.cos(n3 * pi)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "a, b, c = sympy.symbols(\"a, b, c\", negative=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "d, e, f = sympy.symbols(\"d, e, f\", positive=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Numbers"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "i = sympy.Integer(19)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\"i = 19 [type <class 'sympy.core.numbers.Integer'>]\""
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\"i = {} [type {}]\".format(i, type(i))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(True, True, True)"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "i.is_Integer, i.is_real, i.is_odd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [],
   "source": [
    "f = sympy.Float(2.3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\"f = 2.30000000000000 [type <class 'sympy.core.numbers.Float'>]\""
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\"f = {} [type {}]\".format(f, type(f))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(False, True, False)"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "f.is_Integer, f.is_real, f.is_odd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [],
   "source": [
    "i, f = sympy.sympify(19), sympy.sympify(2.3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "sympy.core.numbers.Integer"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(i)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "sympy.core.numbers.Float"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(f)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [],
   "source": [
    "n = sympy.Symbol(\"n\", integer=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(True, False, None, True)"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "n.is_integer, n.is_Integer, n.is_positive, n.is_Symbol"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [],
   "source": [
    "i = sympy.Integer(19)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(True, True, True, False)"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "i.is_integer, i.is_Integer, i.is_positive, i.is_Symbol"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAy8AAAASCAYAAABSIeHeAAAABHNCSVQICAgIfAhkiAAADXFJREFUeJztnXusHVUVxn/UIi8LCD4alSgYFKRGJQLiAy6vRkEIoPCXVVQQIhGNViEgejQ+AA0BiUYaRUWMf4jigwCCihYQIgqoCAjaHqVAKy2vKpXn9Y+1p3c6nT2z1zdzttc4X3Iy987sPWuvvb71zZ4ze/aBAQMGDBgwYMCAAQMGDPgfxSHAlcAKYB2wDPgesHdDnTcB3wfuAx4L2yuBg3uqcybwc+Du0KYHgJuBTwLbV8puDxwLXAL8JZR/GLgWeC8wJ9Iej40YFgHT4XNsQ7kXARcA92K+j4FzgGf3ZGMT4D3ADcBa4FHMl5OAZ7Sc3xMXr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twfg6NvxVzItCnc9Uyh8Uyj/Exi/keOvswszSbmXMYeZHrq6rHDs97P8tafNQFRsxjEL52Fy/Pn5IrM3G1jX79sAea6+lftqMNy5eP3ajPhYvxlaemKZ+1Q+vL6qdKkY097FSx8tL8MdFyck6jOjXfy9flJxUNAz8ccn1A4JqLBeFej+JemBQc0XhcRlTtH+brNjI0S7FjqLHOX+kMpUvMYyI5716bfX2sZIrs5lj3vJdxxVtdlRtzaV7So5VMSLO41zjF6/valxyaNJEOVl+8nIxth70gdjLZ5dgHbIr8FbsFy9PYWY+HNgcu72A07D5fr/BgnkE9k3KcVhn06HOm7HHZUuxX0Fdg73wty/WwStDnQLvAj4dznUN9kJdFWNsFQbVRhe8H/g18CXskdntWH/sh83DPK0HG1dhhL0VI+JuwMHYtw5HUv8NgTcuXj+OwvhzNba04FpsOb9DsDv9y7BHoF19Ue1MGgovwR8XJSdzwMsXJScVDVPiouSwUkeN5fvCdknNsTKUXFF5fHj4wMxgdu9SudXYHGzVRo52qXYUPc7FMUjniwIlj5U+9ubKbOaYtzxosffYUbRVbZeie0qOeZBr/OL1XY1LDk2aNCc3wKbYXM4bsF/mfBJ7aedS4is6bYfdSS3HHk2twX7ts+nHZzx1FgBfxh7Rrg5tehibFzhi47vhEe1zGX/Z0UYTCvtN31jvgC27dx/m/9+wOcepdtpsfBT7hdSHMDIux+5yX9JyXm8sPX7sC3wXuCO06wlsicyrsDXyN+nJF9VOFSP6ffJQHPPwsoA3LkpOenxR63j4ouakV8OKNnvjouSwUscby11Dm++m/YcmlVwZofVXW71xRxs52qXaUfU4B8c8fIlhRDzvlTwuzueNpSdXFBtqu9rqjTuWL+CNvdeOMj5U2gV+3VNzrIwRcR4rWqm2y+u7EpdcmjRpTg4YMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgP8P/AfrlkCFxpKiXwAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle 8663234049605954426644038200675212212900743262211018069459689001$"
      ],
      "text/plain": [
       "8663234049605954426644038200675212212900743262211018069459689001"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "i ** 50"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAB9wAAAASCAYAAAAZg6XGAAAABHNCSVQICAgIfAhkiAAAFp9JREFUeJztnXvwblVZxz/neEhQARP1MJVjihgIjegkUqa+4C0vMGjWH07oyXRqxtGaMjSmhne64iUGhy5MqRXa9IfjIImUkqOBKF0sK1MBhdcgJQQUEAjBc/pj7d3ZZ599Wc93rfW87/x+6ztz5pX3Xc9ez/W7nrV+272hoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiIhk7gNcC1wB3A/cC/wq8CXjIwPi3AR8HbgLuA+5oxp8LHDUyh1XmKOB1wCXAlxuZO4FPAT8H7Jyw59nAB4GvA/c3nx8DXpJpjlcCFwJXAXcB+4D3T+gDsGrGDf27ZUYW4KzO+NdFjI+VscbFmiuqXoqMNS4rbDFJyUmIz8sWL21+v7mZ6wbgA8CPDoxVclLRyxp/63jVxwongc3HyvgVet2X5jHLHIrMHsZtb/99d+D6PwC8F/hac/0VcAHwvRM6KTJdxPCLwn0Wvfag+as070Ea75fiPW8+7qLE2gp2finN+549Uh+WPsESSw8Ot9SL6mOvmvTIY8WWFeX7N2se75nQaYrDrbYo/tpUGY+9oVeNKf7y3E9a1zylr/Ko/S5K7A3VeaA8t1r9tQeNk6y2eJ+LxOqmzKHmi0fvaq2vFiX3kyvsPlb37BZbwFYveybsmKoVr3OO0nys6LUHm888129rjlltAZ3DSsdF0UvhvdJcqdjiuW+11qRXj9ii5N5YmaOP2L7K6mevc8Stole1peq1XW0pOseO3n9fTCC9W4EPA/cAzweeQiDRnyKQYYvvAP8CfKGReThwCvAjzeSnEBocEmR+AfhjAnF/AvgvYDfwCuDIEb0Afh34LeA24L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nBLvbQ2Wn3sUZNeeWy1xat/m5NZjehn4XDFFiX2myjjtTdUZKy2KONjdFv1xqucpKx51v7Fo/aHsCTf3jBlntLcCrq/rH2lNV+W+OSxRTd1Dqst4NO7KvUFZfeTio/V3LfaAlq9WGvF45wDyvOxqhfE+0yZQ5FJybFYW1R+KR0XT95TZCz2K7bM6TSWx4ot1pr06BFblNwbK3OMYcl0XwV2P3udI24VvaotVa/tasu6/uZQUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVGxXvwfTfT0ZNVAaAUAAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle 93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000$"
      ],
      "text/plain": [
       "933262154439441526816992388562667004907159682643816214685929638952175999932299\n",
       "156089414639761565182862536979208272237582511852109168640000000000000000000000\n",
       "00"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.factorial(100)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'0.2999999999999999888977698'"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\"%.25f\" % 0.3  # create a string represention with 25 decimals"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAVIAAAASCAYAAAAJ+lY3AAAABHNCSVQICAgIfAhkiAAABdBJREFUeJztm2tsFFUUx39iq7SKUXw1UaNAfEIi0eAzGgtKgopBjX4wIsa3EsFoFBBNGqO0okFQPyjBR4x+UQSNSJSK4gNtxFciiAFCqxBKFbRSgQBt1w/njL07ndm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Evqv/eGH8uTFXuOnrWK8Ko0Hv/hAS3C3m6nEvP7t3oEnDSqsvHUh66LlPbEnqjGtls6SJ7CuqKY/N7mThL62wh+SZTEs4sekaGUVik/umGzUW/ADISzQAvx4gLsvC4GH8cHlDez/Q+RpAEVUjge8g+0lBqTlp12XDSqsuGM9B0Bctd4SOHAZao3zwu6IoTh6SxL9A26xK0WQjnOq2zJsYfDAqTzJ6L0i/mZtNnWo4n+vjTxXrDpgTiAswAnkOeArXAHwVwA0wGBiOLvAfy1HXJSasuG05addlwBpquQ7WMO8YT2PeXgBOHJLEP1nrdyM57EiTlfIFMuU8FDonwj9KyJcE9i9kv/6PQA/kjkJ2uqKfS48r5jt5rolE4IsI2Blno7SBiCO2Ik1ZdNpy06rLhlIuuG+lZuzsh5JuAJJW9ZL9V6Ipj83sFmKz3+yBHnb5w3tS6T4bsVyCxtJN9nKlf+6UiVOE+5PjA88gUfj1yMLUWWZCdHaq/EjgZOVbQYtinAE8gawhfIhtNYbQArxvfG1XYWg1sJPK+7D5kKB91BswFJ626fCzloWsxch7xcuT/thT5854JXI28ujgT2FkCjs3vFeAuLRfmqNMXzoNIbpqNnOv8FslF1yJ5504kmQZw0S9ZOAl5b7UVGbb+hqxbRI0qW5CsfUrIXkf2cYGoa1WI8zDydkG7BteMjIDDbbvmpFWXj6V8dFUiewlNyCZIJ7IMtoz4XXEXHJtYQJJNoZtMNpyhyGy5GclVO5E3kaJeGnLVLx4eHh4eHh4eHh4eHh4eHgMP/wGCdNPZIFvODwAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle 0.2999999999999999888977698$"
      ],
      "text/plain": [
       "0.2999999999999999888977698"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.Float(0.3, 25)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAACEAAAASCAYAAADVCrdsAAAABHNCSVQICAgIfAhkiAAAAa5JREFUSInt1c+LjlEUB/CPiRLGi5mYBaV5MyaU0qQpNizsbPwF/oEpC3s2wkYsSBaj5h8ws/MjdmOjjCzkJRkpMn6UxowMeS3uffJ0PZf36d3Mwndzer7n3HO/995zzsMyxVaM4w2+YRYXsbFmnvO4i9f4ik+YwSn0lQNXJAubuI/NmMJT7MchtHAAHzsUsYSHeII5rMUoRoQDjkaBf+AW2hhL+AuRv9qhAFid4c/EXFeqnIPR+RI9ia8XX7AgnKgb7I373CmI8maHo72Nn8nCeUxjjXCN3eBotI8LYmXJuTPaZ5nFz3EEQ0LBdYqTWIeGUA8Ho4BzVSIa0X7OJCv4DTUEFCK2lL5v4jjeF0T69n9D0UntmiIG4toBHBNqbwb7qkQUJ22oxvokri7e4YbwpH2YqBLRinYok2RHtLma6RSvhNmxG/2ps+nfLbqo+xYl3EpbZgrXHVZNDGNVwg8LNZCix+9hNZ1T2CypnMRZ3IvfLcnMF/4rbWxP+BP4LrTytZhnHC9i/FvsyomAbbgeA5eEN7yETRWxORF7cBmP8AE/hIJ+gNOZXP+xPPALuNFi52uQqsYAAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle 0.3$"
      ],
      "text/plain": [
       "0.3000000000000000000000000"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.Float('0.3', 25)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Rationals"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAADsAAAAUCAYAAAAz30VQAAAABHNCSVQICAgIfAhkiAAAAdVJREFUWIXt1s+LjVEYB/CPGWkWSiGmKQtqSrESCyXMLKYpKTP5A2z4AzR7NjSyI5aSrCxIEiUUNalZkIVZSJEUuQiJ5NfiOVenm3fm3rnvfe/C/dbpvD3ne77Pec77nOcc/mPsx2ncxyf8xsUS+TnW4idOtaF3ArfxEl/xHg9xBKsWWsCj5OAz5ppw1io/x6HEH2lD7zse4BymxUbNpnmvsG6+BYxgGEuwuwlnrfJz3EAN/W3oDRTYj6W5Z3NjXwPpLp4mYjNolV/HCozimkjlxep9K7BfSv1wbmwMtirswTJc7pD+3tQ/zo1LO+RsIUzgC26VpDeF5SJjtmKHCHQ6J3Uj2AGMizNblIatYkpU9zpu4gDe5qRupPGY+AtXStQcFEVtEJPYIK6gLTmpG8FOiCvjege034hNHBP37IV8sOpg+0XxuIOPHfTzAk+wCavrxqqD3Sl2vMwULsJQ6v9ebVUHO4lfuFqC1kZxRhvRJx4VazCDD/WBxmq8LzWZ0HacT981Ufna4c+Is/UvtKI3jpO4h2d4JyryLlGgXuNggR9wVLxeitrzNvjbku1wSf4344x4T9fwQ9SB2aSzcr5AO43jYsHru7mIqjAn/kIPPfSwePwB4KuSYDo6Yu8AAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle \\frac{11}{13}$"
      ],
      "text/plain": [
       "11\n",
       "──\n",
       "13"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.Rational(11, 13)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [],
   "source": [
    "r1 = sympy.Rational(2, 3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [],
   "source": [
    "r2 = sympy.Rational(4, 5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAC4AAAAUCAYAAADyWA/8AAAABHNCSVQICAgIfAhkiAAAAltJREFUSInt1tuLT1EUB/DPjMtMJOU2ShFGESWK8mBmSCT3yIPkb5AkSfFEJLm8yIsXUZTxIEJRvOBJXig1FA9yy2XcjfGw9mnOHOc3v4lBybdOu9Zea+3vXmddNv8QluASHuMD2nAac3qwaUAHDuVka3AY1/EGnThe5eyHSa/se5JX7F8w3IMteIGzeI5GrMBqbKhw+ArUojUn247paBdBmFyFdIbXOFAib69kMFpE7QlGFfbmiVu3VbC9IC7Zr2AzCTVo0fuIP6yig+4RHyeidhNPC3pX8RYjS3wMxXycEBfP2/w25Infx2fMxggRwQxNGCLSp4glGIgzfcSpDusxFu9wB9d0D8oP2IhvIuJHsRun8FEUbDGFiMJtR30Pflv8WnG2obmKrZV4WTC8j3UluvUihU5X8dlb4jtE2jVgEKbhiAjme1HspdiCr9iPCcl4Ji6mg/cW9JcnedmlfoZ4JexL9q1lm5nzslwdJFpah7hQhmP4JAq0J2S+f5Z4Y7J/kQlqc5tL01rWDd7jVtKfkWT9sAxXRO/9nci63OBMkCdel9aylpeXf05rE4ar8Pv6GNnULp0ja3WN1jGFvcWiQD4IssQ47xCFVA0tqqfKVAwrkY8TzaET2zJhTU6hVhThAtEpWtMlpog0qhHt8mDSfyTa19wKRFamj5jKi0TErifZc2zO6e/EVpGqDxKHiWJO1OM8Vun6490wIJG7IR5GX0V+ncPCnN6sFIFNFUhnRCo9mDr9ONqbcRL38Apf8AyXxRupRh9gVzp8fF84+5O4i9t/m8R//Ecv8B3gjKVN59Co7AAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle \\frac{8}{15}$"
      ],
      "text/plain": [
       "8/15"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r1 * r2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAACEAAAAUCAYAAAADU1RxAAAABHNCSVQICAgIfAhkiAAAAflJREFUSInt1MuLj2EUB/CPGZcZl8htdjTFaqZkoVCMyIawspH8C2JHiiIiSUgWajbKYlxSGFFiLJSVbNDU+NUsyKUZuZsZY/Gcqdc77/ubS8TCt96e+p7zPc/3Pc95Hv5BVDBY8r2qomvAAE4VxFbhMl7iW6y3sWEoYWKB6D1OFvAfq5jYghpczfH7cBBvcT0MzMVSrMHNomKV+MaK9tioNsNtlTp4BzMKNJPKio3HxEypza0ZrgZd+IR5IxUoOo4p2I4FUeQJOqQzL8JGTMaVDLcSjbiEnshpxlc8wsNqpiqKh7ILLSWaNmle6jLcrtCdiZ/I17uvSof2Y6007VPD/Tn8wGcsyeXX4UMYyeJIbNaPTqzDdDThVsTulZkow/EQ5qd/c/Dbcvyx4AcKjNejO+IrxmJiUYje5fhWaShn5vg9kd9ZUu98xHeSpng0eB3rtAxXi024K70tWTyPtbekXk+s9WMxMdS2rgy3GnMMPyLSberHYunm5NEcayUfaMLsAsFCqa2D2JvhT0tn3lBi/EJoDuX49dKg92JWXnRAusftOIuj0j3/EsVu+PWvuvGgxADMz5jvkIa7TepQn/SiDkMLLuJZuOzDG+nZ3YEJmdxlUXx3FROkzp7AC3yXBvsalo+gGxUOh4nG31FsvHiKx3/TwH/8MfwEgEKI/pytNFwAAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle \\frac{5}{6}$"
      ],
      "text/plain": [
       "5/6"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r1 / r2"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Functions"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [],
   "source": [
    "x, y, z = sympy.symbols(\"x, y, z\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [],
   "source": [
    "f = sympy.Function(\"f\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "sympy.core.function.UndefinedFunction"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(f)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAACMAAAAVCAYAAADM+lfpAAAABHNCSVQICAgIfAhkiAAAAiZJREFUSIntlU9IVFEUxn8qmJOWKxdFrTLTRUl/CBRdJQQtrY0rC2lT1qJFkptcBA1pGzeBK3GTQVEgQcw2g/5RkJC4KGpRE9OiaNFQo9XifMPMXO+9T2ZWgR883r3nO+e875537r3wH2A7MA18AH4Df4ExcXNADmiuMvdh5RvZaMCCAh4C14AJoAs4AvwBLlUppIj7QBZoSXLslJBHHi4DfAdSNYo5qm+MJzmek+NZx96BVWWmRiFFLAMfgQYfeVIifE8nkNb4mCc2I27QsdcBs+LSDndV9uM+Mb1Yb+SAgsYTCmoAXgKr+Bu3G1gD3lK50pv6oK+aA+KmfGJQop/AG8feLCFLoUBKFTit+bjmd4B6j3+r+OehhPvlMOvYO2TPRMTsAvLYcTBKaRM0RmLywJcQOawkFx17D6VVxnCdUp89AbYm+H/CKg6sL98hvV879rzeTQnJv5aNR7BfHkOqLPc6PMa27zbHvhNb7WIk8ZBis/K9lSCkXv7vfGQd8ANYCXA5KldejhPYtbEEtGFnSAE7EkLokuh7PnKfyPlA8F3x7Y69D/sd74Edsp2S74OImDPyGfWRQyIvB4KL/PkyWzd2PWSBPY7/C/n3B/Ldxpp3t4+cVPBAILgR24bPNG/X/BtwwONfPNSeerhWrHFjlUvEFX3gYC1JgAvEq7YhNGGX20INOVLAZ6wHK+C9MSNYBV4BW7C7qlCFmL3AL+AG1m+bSMQ/jk6QTOyk7vsAAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle f{\\left(x \\right)}$"
      ],
      "text/plain": [
       "f(x)"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "f(x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [],
   "source": [
    "g = sympy.Function(\"g\")(x, y, z)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAFQAAAAXCAYAAACVp2gDAAAABHNCSVQICAgIfAhkiAAAA+hJREFUWIXt2FuIVWUUB/DfOBpjU1hBNwmLMC8PZdE9spesoIigy0NB0QWESInUoITIp8xuEJlRQdmFysrKLhBDPVhNN0QhswtUZFEzdrOycrzU9LC+w+xzZu+zt3Nm0mD+cB72uvy/tfe3vrXWdxjFHonH8QM6d3cg/xGORz+uGQnyE/AP5o0E+R6MF9GDfYabuAu/YvxwE+/hOElk6cLhJJ0isvOh4ST9H+FTbER7TTAmx6gDN+ET9CWHhclpCz7K2F6NNqwoWLBL7OKFDfI2LE+623ftHcxPfvML9FOxDW/tIi90J+6i3+oG+2cwCbOKCDvxXnJegyXixfvwRJI/lrFfg52Km9EM/C02pz0jvztxDSWzT06+zxXou1JMxwyBewEW5fw2pjUXNdjPSvK7igifTAa3iCyq4UwDu3R9knWmwNeXBLk8+V2Znhem5xXyT0gZxuEvfJOjuyRx3zsE3iLcmTgfNTjeCUn3YZ7jKUn5UgFxbZdmpucp6bmrJKDDsBVfY07yeR17lfg1w+rEMzEj68S32CRetFW0YVlaZ6n6BMtiK3rzFLUjfWKB41rRgPZNz6cayLQyLDaQ4d3Yu4JPM9xmcG1eov4ktIJ2Udr6E28zfCdO6iBswk+Kd6IHn2eej00LrqoQ4DwDH3RaBfsynKf+ZadhO95VHH9VjBP1uR+3VrD/RTTrOnQkgnUFTtOS/umMbGKSvVOy4KUis3uS/QMVgizD/omz1nXfEM3vuBZ5O/Cq5lNEFmNSHF82KsZih6hzeXgkLXJjRtYmrps/NlnwXJE563GgmNt2GJ4s3YA/cVmKbVmLfJ14U3ygayv6TE9rrywKsF909CyuM3BcG3XPJ/nkHL7TRTf+Cocm2cWaN77lqtfBB5PtFrGpBzSxLeOdIGr7TlxRYe0arkq8c2qCsRnlYtGYXhONpld8lKPwmRiY1zYQrsRFOAdfZOQzxNH5DWeJ405swBpcIKaFtxv4amNJbpFvQDdmi7v0DaKWFaGM9ymcJsafIw2eN4nvs61BdrYoNYV9ZK6oB9vFnHc/DsfPBn9MYvTpxQcZ2eQk2yx/uK4Nw+/n6Nbhd1EjyzDTwAxY1oia8Y4RWd7shrQpx2+CGJmKTlshLk+kCwr0Nyd9qw1hP7Hbd1S0fznZF415Q+Wtirnq5/I6tOOgHPks/CGytehvqg4x9L/SYoDniyvuIRVsa41o6TDzVsV4fC9KWC6OTouuwj24T9S3flHwy7LvDDGzjeQfzJPEnzYPi1r2sdYvCEPFdFFnjygymIoXxNTfJ7rzBjE4Hzzi4VXDbLHBm/Gs+mvnKEYxilHsDvwLstoVuCMMkP0AAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle g{\\left(x,y,z \\right)}$"
      ],
      "text/plain": [
       "g(x, y, z)"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "g"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAFAAAAAXCAYAAACcTMh5AAAABHNCSVQICAgIfAhkiAAAA2lJREFUWIXt2FuIFmUYB/Dfum1ZRmYQlZVFSNmBLOhEZEQYSBFR2UVedLgpougkgXSjF5lZCUVihlAbSNAB0vAiOpCWW2JHsKiriA6URIctaqu1tovnnXZ3mplv5vv2a5H2D8Mw8z7//zwz87zP87wvU+gqlmAHBvEnTptcd/5TrMAwvsEmHF9ktE+FwEnYiF/wLL5KYv8XbMV0ETSXYTbOaiJwM0Zw60R7thfiXfyFA/MD0ypIh6Tzx93waC/DJ+jBrPxA1QfsTefhCpuXRJRekbvfg/40dl9dLxOWJt7SkvET8Dteb6gLA0m77NhWwsu+QW9+oCoH1sFdeA/3YLMoNPAgrsUGLGuouT2dzykZf0S8yC0NdeF5vFxw/3rMwWttaJbiIfFXzm5h15/srkvXd6frp1VHeBn68Cs+Lxi7Kmk/3IZuGR5Imk8o93d9splfV7THaOI8vIXtURjCZyIqRvAi9q37sAJsSzqzx9ybgS+wGzM70M7Qg3XpOWvTdRmWJbvbWokuwhq8nQjrazqzymgeGcABNXlluNe/c+tq4yO9E/TiyaS3uob9kSJAhvEMVuLYIsNs2o5gF06u6dCdY3jzanKqcInxLzcPf+BN1ZFSB32irx3B8ga8G0Vqyd7zgjLDg0TjOIQvFVSeHK4WU/3rJPxoA6fKMCtpZlXxFVGgTu9Qdzq2qK7yRch+6HYRVH11SBsT6ZQKm4tFZOzCoaJnHDYxUfiRWAUtSX6s61BvBl4VP+amhtw1yYeFTUgrE+n8kvHzREh/iiPSvcWJs6mE069+Hnss2f6Mb4029u3ozhS5eQ+uqfHsPB5P+nPzA1V9YNY8FpX2+WIqDOIiMX3hObwjUsACvJHjZVp7ajg9gBvE8ukOfF9h20r3KZyLnThObBTksUo06O3oF2K54mQ5V2wq/IBTC3gLE29Hwdj7+EnBkqgAC5LOTq0LR5XuNBHFVSuQ3S30+5PdMTX8/gdZ73N5E1IFDhaF4P6a9i8k+zMnWLcdbBbf4rAmpCsTaQuO1t6qYiwuxW9aN+aMFo61E6zbFPuJLazBdDT6BvuL6jo21Lu5oTpHRP0GkYs+1HlD3glWGP/uhT1jVREZwhm4ECeKZN7NDdVFIpH/KKbM7aLKTxa2iqLxHd7CB5PoyxSmMIXu4G8sieQTLBxG3gAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle \\left\\{x, y, z\\right\\}$"
      ],
      "text/plain": [
       "{x, y, z}"
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "g.free_symbols"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "sin"
      ]
     },
     "execution_count": 49,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.sin"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAADkAAAAVCAYAAAD8dkbIAAAABHNCSVQICAgIfAhkiAAAAt5JREFUWIXt1kuIVmUYB/DfeB8tLLRAUTuQSW2ScJAWtRDEQkKiVq0KBRFLFy2CBHEXEd7AhdAFLIgUJhQCkYGwIsS8VCDqSvGGk03pbHRKpz4Xz/vh8XznzCnnoAj+N+e8z+X/Ps/7PO+FByhFhhZ2NMj5BX7HlFFwLBBxrWgioEyzSfbgX7zbANdu9OOh0RKNx9OYMVqihD4MorsBroWiAOsa4GoM80QVP26Q8yTOYmxbMKZgsAzfipL/jYv4HqtzNpnOds3LMuzEH/gLR/BKRUDL0YVdFfq+xPtaQd6V5mrhw4JuJ+ZgcRnhyuTUL1b2A3yKQzhckVBRtl8cIAexBZ+LRP/BopI5j2BY9YEzP/mekKsMNqX5yjpgcdJtLCM8Kqr3eIlueu4/U51kCxsKvi8l+d6CfIpI8FhZMDnsSP5vpfG6NN6lsxNhatIfKiM7iqt4tGbSTHWSZ9y+4m2cFe2bx7zk01cz3ywMJe53ks8+TBjBZwi/tQf5lfgSk3FctNqreKwmgCJ+Fe1VxHmdizctfa/UcF7AVjyBbTgg9uj1EXwuy3VfPsnNeBPnsFbcOZfEPuupCaSNwQr5sM7WGkrfSf+BdyD3vwLXauy7c/yVeARL8YmozJ9u7dXMyKdrGb5L+jxmJtmPNbG8Ia6Z/mS/vcZ+TLI/VWN3Gz5L5K+ncaaZJLvESTzQYX0LS0VbHhNb5yRuiMdIFZ5Jc33dFuRb6GWMK3FqV7CuRf4vWvhB7J25JfoX0Cv25BKxGOtTjMW7MY/n03d/mXJQnEi94o7ZJI7hlrjPxie7TDOVJFqxhbcL8vkpnn48WdAdTj4vVsz1lTgDZpcpV4nD5rSo2mX8gvfwcM4u01ySE8TC/pSTzU2yK3i2xKd92R8s0U0VB86eijjuGd4XQT/XANcaI1f5nmGSeCx8M0qebvHW7i0qyl4ndxvD+BkTxd6/cYc8T4ln6Ueq7+sHuK9xEyfxyH1exnKjAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle \\sin{\\left(x \\right)}$"
      ],
      "text/plain": [
       "sin(x)"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.sin(x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAB4AAAASCAYAAABM8m7ZAAAABHNCSVQICAgIfAhkiAAAAJVJREFUSInt1KENAjEUh/Ef5IZgAYbAcWEBBKMwADuwwAn2QLAADkVyCoUCgwNBFaLpXUpDyH3JSyte+4n+X/kTVtjigBue2JUQH4PsjlNJcY0pRpjHxFVm8T61cZxZnMwgbr0DkVq9E/sZrjMeHc5fcokXfS/qys+8cTFyfyDLUDAJ6wxN2F+xzuwEG/EpaL8hHYjyAqjXJ2KDRzE8AAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle -1$"
      ],
      "text/plain": [
       "-1"
      ]
     },
     "execution_count": 51,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.sin(pi * 1.5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {},
   "outputs": [],
   "source": [
    "n = sympy.Symbol(\"n\", integer=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAA4AAAASCAYAAABrXO8xAAAABHNCSVQICAgIfAhkiAAAAM5JREFUOI3N0rEyQ0EUxvEfJcMVWhoZ8Qpq75PnoDJ0Kl5BK0U67yAUiUYmpZGYoRDNuePOkXszYxS+5ps95/x3Z3c//lC7uMIz3jHCOVpNUBsTzHGDU/RjfY+dOvA2hrqpfhb1y0XQfjSHWE29DUwxw7o0cBzew2cCX3GHNRxl8DD8oeYaj+GdDBbhLzVgWd/K4DKthM8zWO5YWKzN6lwVHIR3asCD8B9v0Lb8O97Ed2T9KgDlqdXInfiO3EBD5GAP1xjjA0+4wHYT9I/1BRgnMa7SDNsAAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle 0$"
      ],
      "text/plain": [
       "0"
      ]
     },
     "execution_count": 53,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.sin(pi * n)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {},
   "outputs": [],
   "source": [
    "h = sympy.Lambda(x, x**2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAEsAAAAYCAYAAACyVACzAAAABHNCSVQICAgIfAhkiAAAArBJREFUWIXt10uoTVEcBvCfR9zrdcujECOXkEciJUxQSjGQkhkZYsKIicfEzWNiQBlJSYooE+4YeeWRYkTHgIuryMDN8xqsdbvnXvvsva5zcOh8tTpn7f+3v/Wt/1577f+igQYysBt38AGduIw5f9VRHeMqtggJmouLeIWx1QqfxhuMrFaojjEK37C23/WF6MbWFJFF+I6dNbVWf5gkJGVpRuwiOoSE5qId79FcU2v1h3O4jyEZscVCIvfkCcwQVtXJmlurLxwWVk5rDucJnstOJmgTMroyI9YeY+v7XR+EUzHWVkF3I9blGOtBK8Yl8KrxdBSvMbtAe2+8f3Ulwl18lb2xzxc2xMf6ZvtoFM1bjSXcLDDXghd4ID1hA/V0TFqiYFXUOJIVHCkk6lGOwKkosDn298T+OQzOua+kOFmwK+o9xPgE/kA8HRdqrBWYWNYqbeItUed2VnBGDLbnGJuCLmHy2yP/CoblzSbyb6Epoe02sISleuqu0PblaHcJtdhPWKL3ieThYNlA1zGigE+YSCWzee1ygvavekrBC+FtA0PLAl3xt6lAoLPs/1Z8TBz4rVBFF2G03o9ByqtbjaciNOvNSx9MFp7MtZybNwmlRUfknkgctCRt4mNwI2ofSNT+VU9FGBx1n2YFBwlHnM6sINbgs/ABmCDUIV8wM2HgkuJkjYqcbuxP0KzWUxFmRS8XKhHOR0L/Ym2ZsLSfCccE2BC5lxIGLilO1hCckZ6oaj0VYUvU2l6JsCkStpVdmy8cfzowrR//TuQvr4E5wupOwZ/wdFbY3KdWIgwTPpW3Yr819t9hXga/p3BL3YhrgT/hqUXY2AtXaE+ds6CKwf517JC4OpuEA2RqjfO/oRkvhf27D7JO1F9xD8OFs+KX32qt/jAdn3BI2BcbaKCB+sEPtV/XUosGH/4AAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle \\left( x \\mapsto x^{2} \\right)$"
      ],
      "text/plain": [
       "     2\n",
       "x ↦ x "
      ]
     },
     "execution_count": 55,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "h"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAABoAAAASCAYAAABFGc6jAAAABHNCSVQICAgIfAhkiAAAAVxJREFUOI3t1D1LHVEQxvGfQVBSWKioVSxMp+BHEGxExEIlnWihXSDYKYLoB7AQLLSwsLO00sZCEUshoPgCSnKxSSAIiiaKb9dij3Bddr33bpPGgcMuO/+ZZ4YzO/wHq8MoVnGKG1xiByP4kBCTQz7l/C4EKwvev2ABv7CJMzSiH0voDkw+JnaJuYQirtM66kRvQuVNQTSPgYSOcmkJs9hkEJrPKlRZHAH34fmQ4KvCID7hL/awjccSc78qZl/UUVfMl5M8CD/QUa7QbAheS/BNi+62ER/RhkU84R/aSxX5FkSOUJuhuNVS4K8BPhBNXjn2OcSeFwPHAriPhjJFoCbE374FjQfoO+oziBANTR6HacBUAHYVv5PWFKYZJyHP5MvHigJgGMui+Z8XrZa45QIDM5gQraufuEILelCNdfThLp5kRvqCfDlbBXwHVnCMC9FP/QcbGIo18W7Z7RkZc2OohXYbCQAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle 25$"
      ],
      "text/plain": [
       "25"
      ]
     },
     "execution_count": 56,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "h(5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAEsAAAAYCAYAAACyVACzAAAABHNCSVQICAgIfAhkiAAAAs9JREFUWIXt10+IFnUcx/GXFuaqsBIeKrRL6kpYKkYkJWwlHgJRwouXeGq7aRdvCoI3wxKioMDTFoIuBAZedC9CFlSKCZEFGWxgrukhKUhE7fHw/W1Os88zz+zM9uwGzxuGmfnNZ77f73zn+/tHjx4V2IOz+APXcQKrZzSiWcwpvC4S9BSO4yoe7vTiJ7iGhf9ldF1mPZoYKqlfhLvYUiR6Bn9jd63QusN2fIAzovs0caRAfxzjIhGdeDTZe75INIob6CthcKa5ID7oT/ygc7KeTZq9JWyP4Fs80E6wUlTV4ZLB1qUhgh+s+P6LWIE5yUanZBFJ/UVBEvCOqMDl2ca5OdEbyfFICwOjKZhXc+1zMJyevd0h0OnmNH5KvstyDI9jU5vnh/AaXsalIkPncEfrgX2NGPAu+vdfOZSCrVKNDfUqK8ugcpW1KenebfHsffyGJzs5WygS9V2BZjg5aqT7vel+xOQqLUND95PVn3Tf5No/FJPES3gkc7ScDFYmI6MFjpbiJsawK+lPYl6HANvR0P1kEd9wNdfWbHPsb2Vgg/tVUsSBjKEvsaBEcESC2wXU6hguaXeCQeWT9avoRVPiwcz1zXSe3+Gd65nrIfxV0td7WJxrW4ut+FgkM8uFknar0Of+91biMfFnvijQ7BBLi/Gk/aiOQzPTDeeKb/h5qg6yg/K4qJqBNtpXRAV8j6fxI97Eqqk6nWEGxHJnypWbTVYTn2OJ3GIML+BTXMZmkdR9oht3e21Vl+fS+XRdQztE0nZm2taI7c84nsjpzyb9xor+Gup1w21iIhgWs3JTdK+JtlZrqaNicF9W0ec/zBNT6tfpfnm6/110vTwTC7yvKvprqJes/Ypn1LGcvl8M7J9V9DeJPcnRuukyOIt4S72eMIn5YqN5YroMzhL6cEWMvZVotfO+g/N4SOwVb1c1PstYgVs4KMbgHj16/P+4B5qxwb5YvgnvAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle \\left(x + 1\\right)^{2}$"
      ],
      "text/plain": [
       "       2\n",
       "(x + 1) "
      ]
     },
     "execution_count": 57,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "h(1+x)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Expressions"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {},
   "outputs": [],
   "source": [
    "x = sympy.Symbol(\"x\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {},
   "outputs": [],
   "source": [
    "e = 1 + 2 * x**2 + 3 * x**3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAIQAAAAWCAYAAAAB6jTvAAAABHNCSVQICAgIfAhkiAAAA79JREFUaIHt2V+IVVUUx/HPjBIRBpWVBQURFhKaEb0ESZMVlRH980UIPGFRYEQPRX8gGiKZiYz+SPZQxBT1IAQFFf2HyCxBccyBhqJiKkrNSbOiKK3pYe3LHe/cf3PmzFwv3i9s7r377L3O+u279t7r7EOHDi1kNXbgt1Q+w9Ut9Wj6uB9bhM49eAMLW+rRYci1WIazcDbW4ADObaVT08S7uFkEwSK8hl04oZVOtQN7cVurnZgB5uBfXNNqR+rRXfH7UXyIH/CX+LMG8RDmFnzvWVghBurTgm03Yi5uEbP2a6F1Pz7BKhPHpQiOTXb3ToPtRizHOmwUW9gYXm6m4z/YjBfQn4xsSQZ+xOkFOLcIf+Ag9oktZKa5XWj6Ca+gT2j+NdW/iq6C77lBTK5ZBdtthu1C1+8YNomAOLpG/ZpkZH0Bzh2F+bhA/BGj8iVbWfKpJ0ffpWLprlwJTsH3ye6NOezW4jHsFLrzksmv9xKRt3Wl/k0HRC0WJyPvV9S/l+pvqKjvwkC61t/A9gd4PodPmfwDVI8Hkt11Va7l0fs4duOcKfqVKUZvjzoB0exeWUqEdlTU34P/8IhDl8K1WInncF8D291qr0yt4ED6PFjl2mT1Po2bxAz9onBPZ5C70YsnRCIyhs9xUpW2A+l6ln6XZtgGEwOuH0twhsgl+sQAX5XDx0zxK8RsDCW7V9RoM6A5vetFArdUbEWlMienb5kZWCFqsSt1KpW3Ma9G29NElj6CO1L7d0SuUMkAvsPf+FlsF7UGvhGZ4gNibbL5Vp02zeodq1F6c/qWaWFAlJiH6/GlyMjPr9GuT1nwJhyT52Z1GFF7gKuVgRz3uDP1Hdb48Kid9faoExCzG3TeLZ7Vt+ErvKT6E8Gecd9X4c9JONgMT+K4irrzxMnni2IAx7N9kvZX4ymxz1+q8VlBu+sthEERWSdW1K8QecDOdP3ZGfInU8wSeleyM4STm2jf7np7FPDYSawWYzh+XN0ycZg1JBLOYZGlL5jqzZogM/UBujfZGDQx0KvR7nqZREAsEFlwJd3KB1ObxtVfJJbKb3Fqqlue2r2e293myUxtgB5M/bdq7oVTu+st0aPJHOJKcaL2Mb7BLyKpvBhniiePW1PbxXhTnP9fLpZP4sh3q9jrlohH1sORlXhYvGzaKBLKSkaUk7V213tdKpQn/YXK+kbFUcMhLMQzIkEZFQcz+8W7jF7lWTRfBMc+1V9bXyYicPOUJDQmk3/G9GqcuX+U2h4JekcK8K9Dhw4dOnTocATzP11PSQX3Ov8WAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle 3 x^{3} + 2 x^{2} + 1$"
      ],
      "text/plain": [
       "   3      2    \n",
       "3⋅x  + 2⋅x  + 1"
      ]
     },
     "execution_count": 60,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "e"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAIQAAAAYCAYAAAA74FWfAAAABHNCSVQICAgIfAhkiAAABH9JREFUaIHt2muIVVUUB/DfqIhmYG8riiRKNDR7SCBl3exhGdLzi59KKgq0CDFCKRwCcSolSDKIiCHqg6BYWFRmEalkKUxlNQQVVphjmqVF75o+rD3MzPHch3Pvnevo/OF8uPux1vrvs87aa699GcQgBtELC7EVB7AH6zCxoRZVh7n4RPA5gPdxQ0MtGmB4E3OEE0zCWnTghEYaVQVuxEyci3FYgr9xfjVCX8APGFWtdQMQx+JfzGq0ITXEPtzT4/fF6MSdlUyegv8wP9N+G1ZgowhFnXixWkvL4ETcJb7aL/E79mOTIDOkDjpPE9wurYPsx/A2vhNc9qENiwXXWmMoZuMvEf16Yi12iQ+gJNbjZ4zMtH8kFuoXtOsfh7g36fkeL2Epnk/2dWI1mmqsc5V4SUNrLJd4MVsEhxbxgW0VXHbizBrpmYRf8Q9+EltIFpckvYtKCRonosOzOX1Xin2pCQX94xDTRejORoJT8W2y4dYa6ntCfDXn1FBmT4wo0r5EcFlZIz3DBYcp4iPaKz9Rbsc3Sjh/SzLsqjIKC/rHIUphUbJhRaZ9fWq/JdPehNbU15Ijbzl247yaWlkZJgu73srp6yufntiA53LaF6f5M4pN3CbCTLlksqDxDvFgsuHJTPtkkRR+rrfnL0/j86LfUxrnDPCwsG15Tl9f+GTxjvx3dXWSsSxv0ijhDNsrUFDQWIcYJuws5t2tqe+O9Lsrmqxy8PazUiTJ08VW1PWUTbaqwAI0C2femGz7GCcXGd+qcj4tmIaxIpdYKtKA63Pkjk5yPsxTOi51ri9DhsY7xLKk/7Ui/WeILH4H5qWxb4i9NYvOIk9zLQ3OoCOj63WMKTH+UPi0irzgT1E62KDElpDkduR1TNXtdeVQ0DiHuD/pble6eLRU94JvxjH1N+2QMQY34wtxkrqoxNh68dkpdoaDcEFS9koFQgoa4xBzk97PRFgvhfm6F3B8ne2qFmeJL/rTEmPqxWefKCUchNOTsk0VCCnof4d4IOncjlPKjJ0t9s1dac4z9TWtJmgTtp6U01cvPkOS3K/yOpvEnrOnAkEF/esQDyV9bfIXrCdmigLQdpGktYta/uEeJXYLjsdn2uvJZ0LSuabYgNVpQLnCTEFlDtGqd3bcFzySZGxT/sLpMvyGr0UJmii5d+LlKmzoQqu+8xkvf5sborswtTnTV28+c5KseV0NwzID1ojK3wxxd9ATN6WHbmJTxSIR1bAFmTldR6LcpKUC3I5HxTl8o0gos9iRbJiMV8VdxzUivBJOvk3cAk5LcvqKavhcJyqh74kQ/aNIKq/A2SLTv7vH+P7gc61Y26J54/Bk2Ac5fc2KH9E6xYvJok2c8bNhsFKU09mJd0VE6xB1+7xr3q4CzJY+2tGFavhMxNPiTmivcKr94i6jWe/o1x98RosjZ9lIszApu7AKZXCc8L7Hq5RzuOBI43OfeM/Tyg0cIQob66pUOAt/KH88HCg4kviMFHWP1ZVOuFxcfByNf5A5GjBBbFNjG2vGIAYxiEEMYgDjf17nYXa/kGptAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle \\left( 1, \\  2 x^{2}, \\  3 x^{3}\\right)$"
      ],
      "text/plain": [
       "⎛      2     3⎞\n",
       "⎝1, 2⋅x , 3⋅x ⎠"
      ]
     },
     "execution_count": 61,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "e.args"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAACMAAAAWCAYAAABKbiVHAAAABHNCSVQICAgIfAhkiAAAAbdJREFUSInt1T9IVmEUx/GPFQ1hS/8ocGwIyVwapUECIWgpF6eKHIIiIogoCNoMSoKEgoZwaRCCggisqaggMHCQdCmRhjKCyoaCwt6G57xwu93X908XHPLAM9xzfvf3fjnPPeflP45zmMBXfMR97FwumIc4EgBduIt5bFguoGy0YxH7YVWmsBGDEu1rfMcCnuFoTltWrA/fT/nCMVTwDrcxhFv4Evk7aCsZZgyTWJ0v9ErtyndgK94G0MESQS7jPbY3++L5gBnJ5R9F/kAu34bRqF0q8BvGB3Q2CwJnwvhqLt8tfYDT/mz1cOhvFnhd+xeQNZgK876C+mjUDsdztYtj/r7y69KO6ZWuv3raG4W5EuYPatQ7pMmbw4nQjmNtgbZS41xsBORkiGcsvZiGMsbPsa4R82bieJi/klq5VJzOwOwoG+RUGE9hSx3tAH5JY1rBjTJBzobpJDbV0e7DDwl6s3SdP5XUnQsB8lL9P68efMMstkWuP96/18qPZ9f7IWlMF6XltlCgnwtNN55IU9SDNxnNBHZjD562AkUar1qjVz2PpfU9j8/YVeCzN7QvWgVZiZVoNH4DedZ1Q3qBP+IAAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle 2 x^{2}$"
      ],
      "text/plain": [
       "   2\n",
       "2⋅x "
      ]
     },
     "execution_count": 62,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "e.args[1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAABcAAAAWCAYAAAArdgcFAAAABHNCSVQICAgIfAhkiAAAASNJREFUOI3t1LErhVEYx/EPyqBrUYqyMUi4/wCLTMoii42s/gEmG6W7GCiT9U6UBbtSdzAoNtnQLWSgiGt4z63X9b433fsmg1+dOs95nvN9nnPO0+EPaxklPKGMAwxnBT/CQgCOYA+36MoqQVw5vGMaWjOGdwbmfcZcUMQZ2rIGb+AGA2kBx6hgpma9BbvBt56wr4A7DNXLnhc9yIWvRysE8E7Cns2fgKuqVjgf7JVgF31vgC1Rj0+gJzZyafA+vOAaSwF8iPaE2ErKWK1X/Vos8AQd9YLTlNbn5dh8Ec+NwJM0hw9RW1WwnRV4Cq84Rzcu8YbBZsFjouNfoTeszYqq328GnMej6Cr6a3ylkGC8EfCA6Jt8wGiCfzLATxuB/+t39QmeVkMhEWwiCwAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle x^{2}$"
      ],
      "text/plain": [
       " 2\n",
       "x "
      ]
     },
     "execution_count": 63,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "e.args[1].args[1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABHNCSVQICAgIfAhkiAAAAMJJREFUKJHVziFPgmEUxfEfsBHoBjeaBJJ8AWkkI7PY2Kh+Ar6AFrObyUojMrqbG5ENG6PpRoCkm06h3Hdj7MWHYOGm557z/O85/OOMsEZ7Ry/gKby7fXADP5iitKXfB/iYSs8SOrH3Yu+jmIKr+MQcNwEOUU6B2dwGtMYzKnmf9tVYbL27+Dg09Rq/eIvkh0PBS3xhghO84hv1FHgR9WY4De0q0gd/gQ2sourZjjeOA808sIZ3LHGe47cCfklVP5LZAJRWKsLu3YOtAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle x$"
      ],
      "text/plain": [
       "x"
      ]
     },
     "execution_count": 64,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "e.args[1].args[1].args[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAABAAAAAVCAYAAABPPm7SAAAABHNCSVQICAgIfAhkiAAAASZJREFUOI3N0z0vRFEQxvHf2gQbEhI6iQqJUohodML3oNbo+AjiEyhVJATRaSQ6IhqFWmNlJV4qxMsqztm4jnt3NRLTTO4zM/8zM7nDH9kGauiK3+OoY+E3xRP4wFKi76KK7laAQzygkuiTsYuVZsUj8fX1gvglrlBuCG1JwjxK2CoAbGIQM0UdnOHN1/JSmxHGWMsLdsXiiyI6eiLgtCFkRxgQZqs2ATziWRjjB6Av+vsmALhDfx7gKfrOFoBKJvcboJZ0kmdt6M3kfrNSDNw2AYwKS9zJ66COY2G+oQLAVPRHeQAZ8lwBYBbv2C9qsR03OMmJ9QjL2ysqbtiyMM5Yoi9GfboVoFM4mIOMVsE1ttPkcioIv/M5OoTbeMUwXrAqnPo/sk+6ajl6mKyJ+AAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle \\left( \\right)$"
      ],
      "text/plain": [
       "()"
      ]
     },
     "execution_count": 65,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "e.args[1].args[1].args[0].args"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Simplification"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "metadata": {},
   "outputs": [],
   "source": [
    "expr = 2 * (x**2 - x) - x * (x + 1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAALwAAAAYCAYAAABAxJdTAAAABHNCSVQICAgIfAhkiAAABB9JREFUeJzt2l9oHUUUx/FPaqmNFSr+Q0WftEVFraIIokJsBUEQRX3pk7fUB6FVRBBpQcxbi7b4p6Dgg0RRpFCpUATtk2AFtcUWAvbFSirYRAP+Bas2Gh9mQuL1/tm9d/ZOAvuFJTczZ845e/a3szu7S01NTWVsw2H8imkcwHVZM6qpqZCPsEkQ+fXYjymcnzOpmppBcS7+xn25EynBW/gBq3InkpibMYvNuRMZFBfgUWHW/Rqn8QsOCUVYVkHMS4Ui316B7yq4Bf/gqdyJFOBh7MEnwi3kLN7uMmY/JoWJaNAMXH+PCUU5hXewA2/g59i+D0OJY+7FUZyV2G9VHBTqMZw7kQIcE47bbziumOBvjXbbq02tJQPX33rh1qL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(x + 1\\right) - 2 x$"
      ],
      "text/plain": [
       "   2                  \n",
       "2⋅x  - x⋅(x + 1) - 2⋅x"
      ]
     },
     "execution_count": 67,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAE4AAAAVCAYAAADo49gpAAAABHNCSVQICAgIfAhkiAAAArpJREFUWIXt1z2IFVcUB/Cfa1A3ChI/WCNqExUTRPEDIWA6q3SKjV2MpQYkpFECsRE/UCwkESxkEcEohggWkQUrI6gJ0SAoChuUoKsxJLFxE7+Lcx+7O5m7b5/M+LbYPwzvzfmf859z79w79xzG0FYcxR+Y3O5EKsYKvMSmOsRX4gU+r0O8YuzBOfyOfvyFK/gK0zMx36MPU6pOpgf/oLNq4RrwBBdxBLtxED+JVXUXc0tiViV+e5WJLBSr7XCVojViUsa+U0zONxn+Bu5gfMPQUXDoSQLrCvZx6E7c7kH2TxN3IvPAVvXqxr8Z+8n0uyDDf4t5WJMTXornuG7Q7GK/GGRxZf2MZ/KHQqt67cKXIp/9GX5N4vcNJ9KdnD5J99vT/QlDV+hkMWnXmiQ1Ur03iS+wAwdwPuXzK2Zm/Kcmn8vDic4RJ85tbEkBZzGh4LcwcT1Nkhyp3pvE/ZRH4/oBXU1i+lPcsNg1SPQC3i7x+dDAyqlCr4jbhg6u2XVsBJpFdGEtbuIelg/je1fsMPBWxunhoP+b8LjEpz/95k6qVvWK6JX/mJfhXgu+DTwQddovuCUK+cUZ304DYy7FBlFi9Ik3eSjjNzvxPzZJbqR67cYVkd+MEq5DjKE3F/yxKBKviQ/lDTzFohLfcaLNeljCvY5eu/FATNw7Jdz7ifuuLHC12EK/4d1kW58CTmcedirx8yvSqxOLMKvE3mGgAL6Qid2Y+C1FYqlom/rwXoFrtCQflQhuSNzmivTqxFax2s+J+nGXaL16Uz59+CATe1wcDENasvnimP0bS0qCGsXfxRJuQoq9VJFenViMr3EVf4qJeCRe5A5My8RNFYdC5btkm5iIZVULjxJ8pqYdMkk0wGeqFh4F6BRlzqkiMf7/vi3jmaiDJore9WkFmqMFC/Af9opv9hjG0Ca8AoB914h6tHjBAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle x \\left(x - 3\\right)$"
      ],
      "text/plain": [
       "x⋅(x - 3)"
      ]
     },
     "execution_count": 68,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.simplify(expr)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAE4AAAAVCAYAAADo49gpAAAABHNCSVQICAgIfAhkiAAAArpJREFUWIXt1z2IFVcUB/Cfa1A3ChI/WCNqExUTRPEDIWA6q3SKjV2MpQYkpFECsRE/UCwkESxkEcEohggWkQUrI6gJ0SAoChuUoKsxJLFxE7+Lcx+7O5m7b5/M+LbYPwzvzfmf859z79w79xzG0FYcxR+Y3O5EKsYKvMSmOsRX4gU+r0O8YuzBOfyOfvyFK/gK0zMx36MPU6pOpgf/oLNq4RrwBBdxBLtxED+JVXUXc0tiViV+e5WJLBSr7XCVojViUsa+U0zONxn+Bu5gfMPQUXDoSQLrCvZx6E7c7kH2TxN3IvPAVvXqxr8Z+8n0uyDDf4t5WJMTXornuG7Q7GK/GGRxZf2MZ/KHQqt67cKXIp/9GX5N4vcNJ9KdnD5J99vT/QlDV+hkMWnXmiQ1Ur03iS+wAwdwPuXzK2Zm/Kcmn8vDic4RJ85tbEkBZzGh4LcwcT1Nkhyp3pvE/ZRH4/oBXU1i+lPcsNg1SPQC3i7x+dDAyqlCr4jbhg6u2XVsBJpFdGEtbuIelg/je1fsMPBWxunhoP+b8LjEpz/95k6qVvWK6JX/mJfhXgu+DTwQddovuCUK+cUZ304DYy7FBlFi9Ik3eSjjNzvxPzZJbqR67cYVkd+MEq5DjKE3F/yxKBKviQ/lDTzFohLfcaLNeljCvY5eu/FATNw7Jdz7ifuuLHC12EK/4d1kW58CTmcedirx8yvSqxOLMKvE3mGgAL6Qid2Y+C1FYqlom/rwXoFrtCQflQhuSNzmivTqxFax2s+J+nGXaL16Uz59+CATe1wcDENasvnimP0bS0qCGsXfxRJuQoq9VJFenViMr3EVf4qJeCRe5A5My8RNFYdC5btkm5iIZVULjxJ8pqYdMkk0wGeqFh4F6BRlzqkiMf7/vi3jmaiDJore9WkFmqMFC/Af9opv9hjG0Ca8AoB914h6tHjBAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle x \\left(x - 3\\right)$"
      ],
      "text/plain": [
       "x⋅(x - 3)"
      ]
     },
     "execution_count": 69,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expr.simplify()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAALwAAAAYCAYAAABAxJdTAAAABHNCSVQICAgIfAhkiAAABB9JREFUeJzt2l9oHUUUx/FPaqmNFSr+Q0WftEVFraIIokJsBUEQRX3pk7fUB6FVRBBpQcxbi7b4p6Dgg0RRpFCpUATtk2AFtcUWAvbFSirYRAP+Bas2Gh9mQuL1/tm9d/ZOAvuFJTczZ845e/a3szu7S01NTWVsw2H8imkcwHVZM6qpqZCPsEkQ+fXYjymcnzOpmppBcS7+xn25EynBW/gBq3InkpibMYvNuRMZFBfgUWHW/Rqn8QsOCUVYVkHMS4Ui316B7yq4Bf/gqdyJFOBh7MEnwi3kLN7uMmY/JoWJaNAMXH+PCUU5hXewA2/g59i+D0OJY+7FUZyV2G9VHBTqMZw7kQIcE47bbziumOBvjXbbq02tJQPX33rh1qL5TLoE38agDyWM94Iwm1yV0GeVrBVm99cHFK8h1Hykx/F3YY0gkhHFBE84OU4a/CQ0aP11ZHsMuKep/WBsf7CpfQhjsW9nC3+78T2uTZplOcrmvjO2bUjkrxsN/Ql+ISOKC/65aHtPgripaKc/0tcdPB0HvtjUvk5YdH7lvzPC7mjfajZ8RX6xUz73I5jRfrHaSy060ZBH8HdH210J4qainf5IX3fLMa79WT8W+xrx/7mzca//X55eFRZQ64VL1dyWY5FE8dxXCWIfT+SvCA15BL862n6RIG4KuumPtHW3Kw7+oE3/5cKKegJbo+2HWNHCdrbNNlo2qUQUzX1t7DuYyF8RGvIInrAPUwnipqCb/khY9yfi4OM6vxzaYV68n+KcsoG6MKH9ydJqK3pgKZb7beZnjBT+mplQbv/GCvhcyIhydflOuKJ1YqJEvmWPyRxF9UfBui/v4GALXhbujTbgxw620wt+b8bvXZIrywn8UcL+VAnbIrmfjn9XJvLXzEs4r6ntRtyPNwVxLeRYAZ/9MGx+n9tR5TGhnP7oU4NPCmfKOC7uYrtReFw3Gce8ViZQZormflnsP5TIXxEa8tzSLBP24USCuL1SRn/0Wfdn4qCjuLCL7b34KyZ2kXDpOYOrywTMRJnch4TPCaZb9PXirwgNeQR/TbR9L0HcXiijP/qs+7Mx2BHd75nuEC4b3wifCBBeZ8/i/SLBMtJL7vtif6sXZVXUoiGP4DdF260J4paljP7os+6PRMMZ4XnnaIutEW3XCa98J3Flk5/D0c+dBRLOQa+5b4x9WxL560ZDf4J/QFjcjglPLGaF25S5tnbP2d8VNHBFj3F7pYz+SFD3Ud1X2h8LM9wUfsINLfzMvbj4rFOwTPST+4o49vNE/rrR0J/gR3U+lhMtxqwWFqs5rtCjiumPpa3BJcU2oZA35U6kIh63uK/ONQNmpfBh1YHciVTAsPDocF/uRKpkqXyWu1iYwZc4W1hYncmbTlLW4E88L9wb19TU1NTU1NTULE7+BVPG0K+QZGvNAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle 2 x^{2} - x \\left(x + 1\\right) - 2 x$"
      ],
      "text/plain": [
       "   2                  \n",
       "2⋅x  - x⋅(x + 1) - 2⋅x"
      ]
     },
     "execution_count": 70,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 71,
   "metadata": {},
   "outputs": [],
   "source": [
    "expr = 2 * sympy.cos(x) * sympy.sin(x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAIMAAAAVCAYAAABlol04AAAABHNCSVQICAgIfAhkiAAABKxJREFUaIHtmX+IVVUQxz+rZpqF9kOpMLrQtphBJolg1B/9AEsqokTynzJSkdRIwUIj8p+0TPEPCaMsLIja2rCQJBbC1TbYdFeFzfwjU1fQV5qbIbVt7vr6Y+b2zp57zr337bvvtuH7wsLeOTNzZubOmZlzH9RQQ84IgCKwNUOdHwCngDEV6LgDseuZTCyqPnLz+WpgPrANOAz0AL8DrSo4rAIDArJNhmnABWB5Brq2AQXg8gx0VRO5+rwIeWEngQ+BtcB7wFmlNwF1g9z8EmAScN0g5W00q12jM9A1HfFvVQa6qolcfb4XeJhoBbgWOK7Cj2dgSKVoQE7I2xnqPAR0AcMz1JklhpTPq5Bk2GTRHwG+RkpOL1JVdgHPWnwB0TZh0gLgY+BX4C+gHXjIY8trKnefZ71Z1x+z6HW6V1F1mHhF6TMd+qYDjcAJxMeC7jHHwTsH2I201x6gE1gJXOqxNW388vY5FitUcKNBW6i0ApKxa4AtwB5gryUf4E+GnchQ1Kb630cSoh+4x2FLO9CHf4iaorI/MDDrN+h+rtN1v66tt+gLdK9e4FNKPh4AWizeNarjNLAZeAP4XmktSKs0UU788vQ5FiOQDLezqAMJ0gSHzDXWc4A/GYpIlpqYqfQdFn0MEpTOBJu3qvw8fQ4rWyPuQXisru8xaJOB80A3cKtDZqLx/wyVP4601RAjgO24+3Pa+OXpcyLWq9CXFr0D+AO4MoWOAH8yHMPdt7qQtmGiQWWaE/abiJTpY8ASlfkKGBkj0wP8bDxvUrllCXsBvKO8Cx1rDcipPWLR08YvT59j8ZwqPQRcZa0tp3T72Ag8Coz36AnwJ8PnHplWJIgmwhPYmML2tZQqz7fAZQn8J5ATGGKvyk5KsVeH8tZ71rt0fZxBSxu/PH32YrEqPcjA0mfiSaTX9yvvBWQGmGbxBcQPkC606LqJ25X2RZLxlIKd9oV2A+eM5x9V9ooUsoeV19fT23T9RoueJn55+uzE86qwE3dPszEOmIWUy37gjCUXkE0yXK+01gR75iKBLSj/5gT+Ycr/k0EbTGW4ybPuqgwm4uKXp88RvKjK9hMdBNPgXaLfJAKySYY65OZxOmb/WcDfSCKPR1rceeJf6i2612cGrZyZYQv+T7z1uGcGH+z45enzALysDO1EZwQbDyDTso1wen7QoAVkkwwgX0J9/fku4E8k8OHXztnEzyYATyvPEoNm3iYmO2TM28SdKn+UgX1/uO5bBF6y5MuJX14+/4undLEPGWhWO/7mGfxnkUm0CblxbECuKWEymffqgOySYa7SF1v0KWpTgWi5Dkv+3Z69PkL8vsGiL0BOdS/wCfAq8Bbi306L93Xd4xfgTWAdpSv5N0Sn+nLil6fPgLzsYsJfi8G/CPnB4wiSmd1Ia3mB6NAVkF0yjESC+J1Bq1fab8BtDpnwA0ubY20scsXynaIZSCk9hZTik8iVbbaD9wmkt59DPpwdRCrCKAdvOfHL2+f/FVYijk7NQNdS4k/QUMHF6HMqjEIm9O0V6hmNnPSmii2qPqru81D9lS4JfcA+5AegdmTQGwxuRuaBdUjvHcq4GH2uoYYa/nP8A9Gh98V2h9WWAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle 2 \\sin{\\left(x \\right)} \\cos{\\left(x \\right)}$"
      ],
      "text/plain": [
       "2⋅sin(x)⋅cos(x)"
      ]
     },
     "execution_count": 72,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAEYAAAAVCAYAAAD7NJjdAAAABHNC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q+4IGOrO8BtyfDmiqu67kadNjwigr5omvzfl/wvnib/tTheDIBvT4Pv2WJuW1dl1L4mjyD24TMcJ3rB3iPo+1zxDHpa/DtjBjM4RPwHt7MBGr82hucAAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle \\sin{\\left(2 x \\right)}$"
      ],
      "text/plain": [
       "sin(2⋅x)"
      ]
     },
     "execution_count": 73,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.trigsimp(expr)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "metadata": {},
   "outputs": [],
   "source": [
    "expr = sympy.exp(x) * sympy.exp(y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAC4AAAAUCAYAAADyWA/8AAAABHNCSVQICAgIfAhkiAAAAb5JREFUSInt1k+ITmEUx/HPmJnGLI1koczCaoaQPylRQm8WViZWarKxU5osxMbOElGarKwUFrORlJJimoWNkYawI3+aJEX5k9fiPKN73+7M9XbvRMyvbrfnPOd8z/M895yny3+q/fiC/oztHJ5hWQXuS4y02NanXIMVuL/UgQe4lMbH8BarKnKv4UqL7Q4uVOTm1MA3HMdHbKqBOYLnmfEQ3mNpDeycxvEde2ribUUTfejBCxz9ncAh3MQ0voqaPYHOAt+d+IQf2FATt0fUc0N8ySfongvcKWqrmaAXcRZPk+1yi/86fMAwxtKi6uDCBM6L8ts716KJ4m/iNLoy9m7cT3MzXd2PVziZxmvFqW+vyJ3RmcS7VbboLclxbJb5wynBIVF7Uxht8bmKexW4WQ2LvlldFJTd/RFxvX3GqQLfNendITp8oMDnQIGtHW5WB8XBPC6Iyemd2HnZs7sMVIG7CMtFw77GkjL44hR8t81F1c3dIcpqSlyJpepNCUo/S5uaL25OD1OSfbPMb1N8j/8RbrYhGrghGvY2JkXNrcBGcXWtbDfBPHJz2ozreCP+P6bxSHT3rr+Qu6AF/bP6CQWiig9oiqQyAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle e^{x} e^{y}$"
      ],
      "text/plain": [
       " x  y\n",
       "ℯ ⋅ℯ "
      ]
     },
     "execution_count": 75,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAADIAAAAWCAYAAACCAs+RAAAABHNCSVQICAgIfAhkiAAAAe9JREFUWIXt1k2IjWEUB/DfnTGNWRrJQpkFGx8x+UiJErpZWJlYqWFjpzRZiI2dpY+ZkmyulfJRs5GUQiELG6ShYUc+miShGBmL8069vd1757nucKX7r6f3fc7zP8/5n+c57+nlP0FnC2NX0I/bs7FZR5P+u/ENfTnbaYxjQZN7T+MVhgq2/izu8lmKoYSHOJ/ND+MdliT4VnA8gXcZFwu2WxhJUtgAypjEEXzCukS/irREhvAiNx/AB8xPVtgA7uMHdtThHMXn3JjE94JtcxW/jZhCL7rxEodShQ3gOiayYOOZkGrNYSu+4CfW1NmzF0tz4yrOFGw9Vfy6xfdQFrf+DF0zJdAp6nEqE38Wp/A8s10o8FfjIwYxKpJPRUVaacEDDIvS3ZniMCIEn8CcnL0L97K16U7Rh9c4ls1XiVupVh7VUJGeyMls7xsp5A0ZebTG+gGRyH5RJmM4V+Bcwt1EcRXpiQyKb3BFLUL+1A+Kdvq1RoCV2bMkusayKpw9icJgXwPcveLQnqaQ34sTn2lsb0BAM+jAQtFk3mBeitNcIfLOn9PVMLaIUh8TLTgJPSKRpKv71/FIJLOrxvomrf3JrItS7r2Ma6IB3MRjUaeLsFa04MV/W+DvYj2u4K34hZjAE9ExtrVQVxtttNFG4Bdp6W93fWkndwAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle e^{x + y}$"
      ],
      "text/plain": [
       " x + y\n",
       "ℯ     "
      ]
     },
     "execution_count": 76,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.powsimp(expr)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Expand"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "metadata": {},
   "outputs": [],
   "source": [
    "expr = (x + 1) * (x + 2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 78,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAG4AAAAWCAYAAAAhKqlXAAAABHNCSVQICAgIfAhkiAAAAzRJREFUaIHt2F2oZlMYB/DfjEli5GMwlCsNTRpGcuGCTDNESpPBhRu2hlIkFyQaOSkhToMyI1eHuxFRyEf5yJhSoxk6NRMZnUyZc4whLpCv4+JZp/O2z37P2e969zvvYP9r9+79vM961v+/n73Wetaixf8S92MnfsZBvI5VQ2XUohbewS0iWefhVUzi5GGSatE7luIvXDNsIv91LG443vEp5g8Nx62Dx/Ee9uPXxGE3HsKyIfDpFctwq5i1vhIafsLH2KiUq0UNd74N5+AiMfIOJ37HLuzBdzgOFycu36b7/YeZUy+4HVtxAB/gGyzHBpyAV3ADppvu+InU6YrM9oUgtSaz/TFd7I+kuFsy4/aCQr6GtWKJKc+Cp4skTuO6GWPZ6d3ksKFkX4Sx9N9jFZ2O4iasE8N8GPiti/2l9Ht2yZ6rdVB4X1Tlf5fsk3gu3a/p1ni1mOL24KgO+6gQ8nxFm2cwhXOz6M6i0N+I64ZNKe5oyZ6jdSEUBqPh3hR383xOY8mpSM8PpOdt5o7QLWIPt1YM6ZlraQa5QjOi78GIELk9xfwcp1b4jqmvtQ4KzSduCcZT3CvnczxTVDQTuDM1eBtHV/hOd7lGMggWmhE9WeLylljkq9CL1jooNJ+4J1PMN+s4P2pW+A4c2yAR4kV1S3rVNZbRx3Jciy9EVXlhF79crRM98M/VcFdqu1fpUGNJlwYHO+434peMTufDUzixZLsA6/GCeCmd+CyjjymxJ9qFL/Gi6uO4XK2D1nAHnhZr8Do19sY3isrmgMj21h47zEVhMAs7sRGfxikle9NaC81ouDvFGcdpdRpcLTay42Ix34s/sLJPInVQGFziplLskzpsg9Ba6F/DfSnGbnM/tEpcIqaJr3FGsl2fgrzWB5G6KOSLXimq2TIWm92A7+iwD0prob/EPZjaf2qBg/qZNW413hBnY1eIqQNeTkHW41JRXh+JuEqc3HyEfTgkipPLcJaoNG9Lvkeq1pvxsNhbbheFSRkTOoqcFULYjzi/wvly8RV80izPOSjkf62r8KwoAL7HnyIxO8XWZObrHbTWQr6GEQtXph9m8mrRokWLFi3+NfgHumgQb8udVfsAAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle x^{2} + 3 x + 2$"
      ],
      "text/plain": [
       " 2          \n",
       "x  + 3⋅x + 2"
      ]
     },
     "execution_count": 78,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.expand(expr)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 79,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAQQAAAAXCAYAAADtPTGLAAAABHNCSVQICAgIfAhkiAAABnNJREFUeJztm22oVEUYx3/XtzQLFTRSLA5kZgVZVFqQUCAVEhWVUn2oJVPKXsikQFP6lJVZFr3Yi8WtL2lqRUKIFHpNya7XEszqS3KtbDVLjSi7em378DynnXt2zjlzd+esa3t+cNm78/LM/J95ZnZmzi7k5OTk1EAAlIBWjzbfAX4BBtdg42KkX9O99Ch7mk1zQB43Pmg4zQF+B/YS4B/gYQ+2PgCKwCkebGVJM2oOyOOmVhpSc39gHDCyVkPKOuAQMMiDrQlI0M3zYCtLmlFzHje187/XPBZZ8V73aPNbYDfQ16NNnzSi5gISHFd66k/WNKIPs6YumvtEClwPfIpsJbqAn4E2YJZRJqBy62emBcBy4Ffgb6ADuC6mQ3cBLcCKmPx1avemSHqLtlUCnorkLQfOBCbH2Jyg7e1BNBa1nWmWstOAjcDvw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q4sbLXDG3Y9fS8wgREq5SaVuP3lJCntcOx37uugJYBfwEXI04Y4H2Mfo81eQyfV0fSV+KbEEXILfHUcwb47f0dT49z3R9kUc0fZBBC3H1XZrmkE3I2e81ZEs5P6EsxGvOmnrHDNTXh1nGDPiLG99zBZBzzV41vBh5ftmunemg/Aw1wM9KD7LFKQH3RdLHa3+KVG7Bwm3cpJi23kUG8QxL3gxkpe4C3gOeAF5F9EWdEl5C7QNeBhYhq28J+IyeN7euvkvSbHIH5YuhuxPKhSRpdqFAdTuE3ugOyD5uTHz5MKuYAT9xk9Vc4R7kBw+7kJXpAPAV8ChwqlEuwN/ADkAc8oWRNkbTDlL55REof5liiyVvCHJBEndrDXJjuxrZgh1BbnjXArdYyt6KfNL8gXxRZifwGJWXO66+A7vmKJMQje3IdjEJF81pFKhuQeiN7oBs4yaKTx9mETNQe9xkPVeOC3ORTidd+LjyAMkrYqOQpvkj5FPpUgdbJ4pm3zSjD5tirgxEbmDX1GhnELJyr6q5R9mTpDm8BHvJwc6JpNk3zejDzOdKI/yyqxv4EvnxRwdyM1oNZyPnvEXEP9duFKKaRwL3AnciX+H9DvmRTJovTiTNvmlGHzbjXGlKwh+5HEQurkYlF8+xkPswJycnJycnJycnJycnW/4FanaGjGT1vnIAAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle \\sin{\\left(x \\right)} \\cos{\\left(y \\right)} + \\sin{\\left(y \\right)} \\cos{\\left(x \\right)}$"
      ],
      "text/plain": [
       "sin(x)⋅cos(y) + sin(y)⋅cos(x)"
      ]
     },
     "execution_count": 79,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.sin(x + y).expand(trig=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "metadata": {},
   "outputs": [],
   "source": [
    "a, b = sympy.symbols(\"a, b\", positive=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 81,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBOR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5vpyy7ILGlFRq4fhW2m1RHDK8hLvRI5QPrxmLZ9hl2d2u12+PVjlSHLIgOnx3huOagGLs/VNufQX6ttcKsLcRlXjg9o22Xo5gGnqrP9gf6XGf0vwh6oo0iVMd/QzUFWnK2EX14LU6V4v2E7HylLy1kdjgbS5hLkEwLAyYauA6m4dhEeOJFceoT35ktUthto88nrgc2qe8gnv4KpSiDjkzcCH2Af6EBKQmv/b1P5TqaXqq3Au6o7jL00L1P9HYauGGRJ9nCcNpcgW30eWcH85Xoz8B6yBV5t2EVy6WEn/JTK9wDPITX/oMq2aSJ+vKi6n4FnkNp/iKm7h+CyC3CD2txu6N5n6gC8Atm6xoDXNVHX+WY9so/PcejjkCX5e5w0uWxAzig7kOuLXcg90mr1fwS4y5FTJJce7oSvBz5C7kwOAV8js8Oa6XXAPRrcBPALQlJG7a3lrhEp9axr8DbkfmGf2n+MHIgXa7xrDJsMQtJmQ1csshydTw5pcblQ4+oGTgHeRM5RB5HVu8sRbxJcVoQzcd8RgFy75wlfSpWDO9XXkgR8VSP+l1y2Ez50n4BcceeRbzUWZiJlYG+Fz29CZubGCv1UA44pLp9Egl6rf/cAPyGJvo2czl24HHiEyv6R6yzgUWTL+K/jmOLyKuAdpDScQD6kDQD3Ef6IV0M0alzWUEMNNdRQQ3n4FzSK/Knxb0lyAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle \\log{\\left(a \\right)} + \\log{\\left(b \\right)}$"
      ],
      "text/plain": [
       "log(a) + log(b)"
      ]
     },
     "execution_count": 81,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.log(a * b).expand(log=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAMIAAAAaCAYAAADljINzAAAABHNCSVQICAgIfAhkiAAABoxJREFUeJztmn2IFVUYxn+umpqW35lmdUtbxcLUSg2KrESzosBCqj9iK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oc8E5uKfEUkRDVLOUqRIkSJFihQpUqRIkSj+BV7sVUO5wOrNAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle i e^{b} \\sin{\\left(a \\right)} + e^{b} \\cos{\\left(a \\right)}$"
      ],
      "text/plain": [
       "   b           b       \n",
       "ⅈ⋅ℯ ⋅sin(a) + ℯ ⋅cos(a)"
      ]
     },
     "execution_count": 82,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.exp(I*a + b).expand(complex=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 83,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAC8AAAAUCAYAAAAdmmTCAAAABHNCSVQICAgIfAhkiAAAAh9JREFUSInt1l9oTnEYB/CPtaFMDS2W9Ca3ttekuFG4kFsXblwQN8qFK0XkRknNFTcydjOJ/C8Jk1I0zEyusJUmXJj504SYfxe/39r7ns7mPbb3avvW6dd5vs/zPc85v+d5focJjA34jlyB7TB6UFtg244/2FoG7f/GFHTieLzfibdYlPA7ISSfL4P2mLAWg9iNASxL8XmMb6gsg/aY0Y6fWJfCTcMPPBhv7YoU5404hW58xkc8xJYRxNcI5VCBvhS+HlV4hCW4gPf4gjYsHiXxf2kXYaawTffQgoNx7RdqdlfCP49P2IzLuJaiuS3GXo0Jn0cT7kR7H2pS4krRLkI15qXY64RdeFZgy+EN9sb7BvzGykRsc0yyH40JrjVyexL2UrVLxnPDWzcbT3Es4XMWdxO2TiOPyeWRO11gy6JdhFnYh/tCrf+K4kNX12jBKagSZnWv9EmTi7qXMuqSEGwQGmguOnAGH4QeWIhNeJJRvx5TcUWYGEkMHUAvM+qiOPmTQuOsxu2E3/64dmbUXxrX3hH49XFty6hbhAXC9l1P4WrwKvIrMuoejXEHUrg6fBVGctbDqwi18SHdQp0OYQ5uRG4Q0zPqdsTYF5hRYK/GTaGn0g62zLhluCmbhDLqx7n4kKz1Xin8EnQJI7YHh3AEr4XRt2M8Eid8/Va8E2Z6u9CkjcJLtWTUy8e4ZszHReH/ZEDYzVXjkfQkJjGR8BcL5pbwzjNEowAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle a^{x} b^{x}$"
      ],
      "text/plain": [
       " x  x\n",
       "a ⋅b "
      ]
     },
     "execution_count": 83,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.expand((a * b)**x, power_exp=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 84,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAFMAAAAYCAYAAACGLcGvAAAABHNCSVQICAgIfAhkiAAAArxJREFUWIXt2FuIVVUYwPHfzBjI6EsXIbzNg9IN0fCCIzoYFkNQLxk9FakI4ktvEemAKBG++KCjMoxCJCiBJvgSPVRQkAYV1RTkDUSD8IqopGBepodv6Wy2c2bcZ890DuP5w4Gz1vrWOv+z9lrfXnvToK7Yic9rLVEFee+P8VWNXO7zOCbWWqIK8t5fYEuNXMYcf+OdMgM0lxSYin48m6nbgN/xDy7iE4xPbW/hJtoy8dtwEpNKuhQh7z0Jk3EX3+AG+tCe6TPq7q/juoGL0oRNWJx+9BVxxT/MtP+M3an8Ps5jxkjIFCDv3Skm9xcsxXP4EmcwLsWMunsXfhgmZhc+zZQ7cUtM8DXMHymZAuS9P/DgqpstJnhmpm5U3Q+gJ1Oehm78gctiq9/CR7l+R3Abr46Qx0bxx4f6vDSE92fYlxtzRur3TK6+onulnPmmWOaX8K/IC+vRkoubg9/S9yfxE54WW6ADC8QV78v0WZb6NeNChd8v6rEDzw/z+bGCN7yIX3NjzsVVnKrSXYu4Sv1JvAdbcTzV7cnETsAdLEzld3FF5JZ7rEz97uWVOSlmBQ6JiSrrUZS8d6tYaesyMU34HtszdQ/rfp8dSXazgcQLj+Fwansh1S1KUq2p/FqSekPkmfdw1sAEt4mbUVeKny3unh0lPYqS924XqehPMcEzsRen8USKKeJOGuiumPXBWCP+xKpUXoujmfYm8VRxTWyBbnEI/jZJHUVvbsz9YgWU8ShK3nstjmE5/hLHooMiXSnint2Se/G22F4nBpGYJXLYanF2HC3qxaMUFwx/R+wXZ8dHwaNqxgvB7xoe1ZN9coGnaiWSqBeP0vSJVbG8QvsSD57vxrJHYbI3oE7xGmocvhYvK5oxBfPEsWT6/+BULx6lWSBemJ4TZ69L4tGwFy8/gh4NGjRo0KBB/fMf0GXfn5zBL/gAAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle e^{i a x} e^{- i b x}$"
      ],
      "text/plain": [
       " ⅈ⋅a⋅x  -ⅈ⋅b⋅x\n",
       "ℯ     ⋅ℯ      "
      ]
     },
     "execution_count": 84,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.exp(I*(a-b)*x).expand(power_exp=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Factor"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 85,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAIIAAAAVCAYAAACKYDYGAAAABHNCSVQICAgIfAhkiAAAAyNJREFUaIHt2U+oVFUcB/CPGuXTwBatwtyo2SqNQhQKJhAXbhRx427IdtmmnYLgzpCCoIXg6iVBCUJBG3Ej+Af8EyGIGoTwhOqJLgwDn5E2Ls55er3euXPufXfuk3G+MMzcc77n3N/3y+/8HcYYowRHcAtL5zuQBvEeetiVwB1F/VTzwPv4H58PM6KGsAPf4DTuCiK/K+H/iGm8WsIZZf2keQBO4G9MzC3GVnBJEP8PrhlsxPrI2VvCGWX9pHngLWE0HJ57jK3gI6zGAnSkGXENN7CooG4+9HeFuDs12tbRT4EHC3OEj2OnRwsan4gv2p4rX4DJWPdFQhBN4iR+j+9OxQ9YgU0FdWX6ef48qKOfcg/AL3igeJO0Fg9x1dOj6asYyHzPIh1pI2JT5H1ZUFemn+F40FV/RsiiI31GKPPAUsGEyyUdTMYOuvF5b3w+6tnZpW10pBmxLPIu5MpT9NO8B13tJ0I/DxDWx54w/fXDcsxgCrsj/zheTo12iOhIN2IGN3NlKfpp3oOu9hOBYg/ARk8yuwwHIq+Hs1iS+OKpTLuUT6qgWXQqtPtTGP1ZpOqnPQ8mE/uleiI85cFLmYqZ+L14QAe3M7934V7ii6/jfiIX/qrArYoJT/TOIlU/9T34Gq/lytZhK74VEiWLS4n91kGRB+ANIaPOlDTeKRyvpiP3UNPRzQEdaSNioaDheq48RT/Ne9DV/tLwjAfZzc20kOlr+jTeImTtFbyD3/AJ3q4a8TxjjXDcy4+2QfoZYQ+yidDDKbyOVbmGH+AY/sBmwbB9wtLS9t3BXLEhfp/MlZfp58Xw4DF2CoZ8milbK1y5TmNljn8x8j9sLsZK2CZsqCaFnXtPmO5my4rOyd8Lm6Q3C+qK9DNcD7rqLw119FPuAcIR6CbOx+dV8fmOMBXmMXsxca5K9A1iv/Jd91SOv0zYIP3Up7+8fobvQVf9RNivmn4Ge/AYe2In79YI7HnHZwaP3lHWT5oHCMenG/h52BG1jAnhSHpsAG9U9VPiQdE/cA/wK14R7t7/G2po7WE1/sVBYb3vh1HVT7oHY4wxxguNRzasRTlC0SJBAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle \\left(x - 1\\right) \\left(x + 1\\right)$"
      ],
      "text/plain": [
       "(x - 1)⋅(x + 1)"
      ]
     },
     "execution_count": 85,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.factor(x**2 - 1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 86,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAKkAAAAXCAYAAABwFW8qAAAABHNCSVQICAgIfAhkiAAABhhJREFUaIHtmmtsVEUUx39tKbZUU0jAaINmE2tFTUSjgiYaNSFqiFHjg4gfdCNKFB8RUBMQYv0gCoiPiNQHavWDghQ1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879Ks9tm14icwi0LgQuAl5GLp8sl0Oe9pWj0MPMrtVyiJPIYlILcJlPvPi4rRDfU8FPkIeqrnAN8h92+Di1Mn5TKTkkEKcb7Lo1Sn5liBjCmOB6cjRNAj8RSYmSuDO7k1oU/J8/KkCPiM4K/WiHOHi5xC6fiQp/LgvZCc9yyL376ReBM0LuDkdh/CjqyJfKjsXBfjr4tTJ+XTgCBIoT0BqVkcxk1WGZN29BlkQ3kJu/FZ1nSCaRerypwYpuxwDHgjp67lqjPUh9b1IMjQx6WrsfyfWkxuT2uCfFwg3x3uQGPdO1X+VYxwXpzly73F5BdAC/AZcqxxbjIQE3tqoRhqpgY3HHA9djzmc0E+qKYQoBkH+1CLB/1XI4rGdDn5cpr43ReBfPmhCwpnFSKbvhze7f1t9LyI7tqxAyjjlyALUyGdeXHMMssuOAV5HwohFFj0NF6dW+WQkXkmRe2zoo+dKg8GZSvagQdaHZGgtCFkrkLJCGol7dO0uQTQ7aZA/n6v2bZjrpI2Yi94fIIvlDIsPQUhSfJ10ECkXfQg8A7yGcOefQJ2s7AdeBZYhp2Ea+JrsykzYedEImmOAu8gkhPeGuC8Xp0Z5vXL6ILmFV8gUV7caZKNV320G2f3ICwN7kafzAPAd8ARwikcvQXSL1ORPOXCI4Gx7v8F+LRK826oLLiQpbpGCZNfrkSP3CJKRb0SSPj/uQHa1Q8ifHXuAJ8lNesLOi0bQHINsXrquaSvjabg4LZZzKxYgTgYFy0OJqPx5GPsJMtIQxOmnyI5/aQg7Lk5LxnkVkkFuiNpwgYjCn2pk12qJxKPhDxunOllaGcKGi1OrvJC3e/wYAL5FYrpOpBpwPBGFP2cjseAy7HXakQQvp11IdeRu5O/qn5CXW1w8uziNOY8RGfQLKgeRhK4uWD1GjBgxYsSIEcOJ/wHYBDr9ydXazgAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle x \\left(\\sin{\\left(z \\right)} + \\cos{\\left(y \\right)}\\right)$"
      ],
      "text/plain": [
       "x⋅(sin(z) + cos(y))"
      ]
     },
     "execution_count": 86,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.factor(x * sympy.cos(y) + sympy.sin(z) * x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 87,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAE4AAAAXCAYAAAClK3kiAAAABHNCSVQICAgIfAhkiAAABH1JREFUWIXt2FmIlmUUB/BfbmkaY5mM0vYFNRJkZvumaUl044U3UV4IGhi0UhBREUUXrd5kG1mCKZGhZSAWGYVltJhLYWUquZQ2uZRbYuUyXZznw9f3e75xzBnmZv7w8cyc7Tnvec5zznlfunDcqKAFMzrRh5nYir4dvM8d4lknHUXukiR3W2tCFZ0buEtxCPe3o81GHMTUEv118azD2mBjHprRr55ARecGbiF2ok872pwsnml0ib4C+9CjDTYuTzYeridQ0XmBaxLZNq2d7X6A7eheoJ2If/H1MdhZhY1FO93aqHgzPsMucVIr8VByoowTcC9+xN/YjBfRgA3pV8akpPd2Kz6Mx5tYgz3YgW8wsY58A67HfHFdqxiKnliGi/AO/sBekfUXZGzNxlkYk9uoIp9xTyb6NryC5/B9oi1KThTxcuJtFrVlSnrYJYm2IbP3UhxQvymcjP34EtPxVFq3p70ezOiMT7yxJfrtib5ABGsunsXiRN+K/iWdMYk3JedcRW3grkq0XzCoQO8hTrJ890ck2urS5r1ExraoDVxfEbSVOacS+pX2r2KwyL6fMrw5+Au9S/RpyY/tGF7izZSvZw2JviTnXEVt4F5LtMkZ+SZxBdYVaNVuNSEjf4184JoSfWHOqTZgtciSInqLgM7JyC9VfxS5IvHeyvD24ffqP0ercRen9ZMMbw024RyHs6t6gp9n5L8SmVXGgLTuaMWPU/BosrFDHFhL+jUlP4q4UWTpvBK9p6hxG0V2lVENTDlL4U+cVv3naO24Ia3NdfjNomg2iFGiKr8lI3tQFOEy9rXiLFwosrFRXJXZ4iH2i0ObgO9KOuNE51xQog8VZWO+/CGendaNGV6fgq9HDdyutA7Czxn+4JLc7rQ2OvIKE618gGgQRVSv2QB5zBIZPVo0oyKeSOvS0j5jxS3ZVZKv3qANdfYal9Zy2eiWfFhfJLSGFWkdleGdizOSsZ0l+Wsz8lfKH1Sz6NhDMrwzRcYtUhu0/g6PIssK9JHiEMrXlHiFglMzvMGi465VG7ghYlz6NqOXbQ5XJ9p6DCzQu+O9xHukQL/O4a7aUKD3wqfyzYEYCVrEYRQxMNHXOHLsGYAPE2+/I6/5C6IsNGb2WZJ01jly9OmHj5LeTRm9iUnvrgyv7hz3TKJvwUti5lmZaItFUIp4NfE24Xkx+6x2eI4rX2G4NencmeF9nHjL096zxCgxJz1oub79mvwqo4eoUcvF+LJWzKRTk6+HcE9Gj+iyB8QNqEFF/VeuW0Sn3CPeBn4QmZYr6N1wX3LuH/wmAt6Q9HPp3kt0tNxr0EDRAbcl/S9EQxie/J1ekL0s0XIfCoYl3jScjndFTd4tsndURkfye5+4YZ2C89SfkYhXuBa1Q+mxoPqWc85x2Cjj7mRzRDvazGKQ2qZzkhgNWsR7bw69xRgw/zj2XqVOAf+f6CNuzNx2tFkXT4sAvJH+niHqTgveF92pHkbiMR3/IbOtOB+PizLW4bhBfM5pFjVurxhTHlD7QaALXehCFzoS/wHExzeGBzosSgAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle \\log{\\left(\\frac{a}{b} \\right)}$"
      ],
      "text/plain": [
       "   ⎛a⎞\n",
       "log⎜─⎟\n",
       "   ⎝b⎠"
      ]
     },
     "execution_count": 87,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.logcombine(sympy.log(a) - sympy.log(b))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 88,
   "metadata": {},
   "outputs": [],
   "source": [
    "expr = x + y + x * y * z"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 89,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAG4AAAAUCAYAAABs4ghcAAAABHNCSVQICAgIfAhkiAAAArRJREFUaIHtmD1oFEEUx39JjIopokKKiNgoaGW0kDQGLKzSBCQWWoQBRRBsJBZidTZqEEEhJBgLzyaggogoSNAiwuFXI/jVyamFBosIoqLGj2LeXnb3ZvZmd2/OIvuD5W7evHnzf293Z3YXCgpajAL+Arv+r4waihbqaY+1Z2TyPTF7G1CWvjNiG5X2qCX2ZuAH8CBkq8gY2zGbIYespMnVN1lqGaEP+A28AjpC9nMSeCpk6xfbdUusGWAB2BqyHQNKhuOtxCrZhBlQ5LvC0+TqW0+WWtZRliBK2iekfZXoHdoJfAPeGWLslTEXHESfFd/L1K8ASSjyL01l3HL1racptVwPfAeqwBEZdBdYbvCdlf51IVsX8B6YA7oT5mkDJmT8uLTToMh/4tLk6ltPnlrWOM3ivlMBVln8TlG/T4wRvYpNdABXxG/MQU81pMflKDvEDHDN1beeVLVcZgnyKfT/APo2NlGR337gBrAFOAo8RJ8YE53ANDCM3tNOWvzCnAdWx2zbgCGZpxrre+YQM8A1V996stQywj7gD/ABfbYnE3zXiG/wNHgPveFvt/ivBG6T/ATliiL/UpkmV9960tYywiDwE3gO9ACvgV/os2/jJfAV2I8WPmHx6wLui7jDLmIaoMhXqCy5+tQD7rWMsBO9TLwBesU2LAFuJoy7KD5f0MvOWoNPN3opWABGXMQ4oMheqKy5+tIT4FLLCH3AZ/SSsTHW91SCDVjGjrC4CR+0+NyR/seY3+NKwIpGImMoshUqT64+9IRxqWWNTcBHYB7zC95uCfTIMn5A+p9gfqRvR19BSU9dc41EGlCkL1TeXJutJ06jWjaVW+hNdIfviZYALatlsImO+55oCeC9lhuA48Al9IfPF7i9tBbU09JaHkJfGfPANaKfaArSUdSyoKCgwB//AHPtHh2GiogXAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle x y z + x + y$"
      ],
      "text/plain": [
       "x⋅y⋅z + x + y"
      ]
     },
     "execution_count": 89,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expr.factor()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 90,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAH8AAAAXCAYAAAAiGpAkAAAABHNCSVQICAgIfAhkiAAAA/xJREFUaIHt2VuIVVUcx/HPaIo2gRUEJSERZvnSha5GhoEV9FKUPdRDbROEoB7MgvIlg8ikHgrFKB+yCMnQzOqhrBDLoQsRQkUPXZiKMjOyCyWVZQ//Nc2ZPfvss89lzhnifGGzZ6/13+v/O/+19n9dhj592uRpfI/BXgvpEefiCJb1Wki3OQ//4I5eC+kwS7AOb+EX0bnPlNhvxz4cM/HSJg878RNm9lpIh9krOvxXfKJx51+QbFZNvLTJwTzx1T/RayEFZKIzFrX4/mU4DQOpjUadTwySLzG1RZ+Z9jQ3xZTc887k/Npc+QA2pboHa8pvSXVbCtpemexX1vF9Ov7Am+l5KNnXu3Y3+jEdZhc+Tb6r8izmYPGEKCqn2Xg7KmdwFz7A/diBv1P5w7gZG3F3jf3iZPNOgbM96X5RHTHrxBdyW3rejtcK7JaKgO6q085kYijdL8erXfbdbLwL2SRGUJaeV6XnLcZmikEcxod12pmG3/FVQd31qc1Hy4TgoWT3pPFZqhGZzqXQRaql/VnJ7r0W/WRa19yJeDsZhzAsRskRvILpObt5qW5nSVu7k83smrJBfI39IlhFDGBDend9em6WTPc7n4jddy36ybSnudV4j2GN0bl2CEcX2CwwmhHq8YDxa4i1xmaWPFPxVLJZW0WsGKhl64X8taliuyMsUr3zvxEZsRHDTeitqrmpeOfn/BEO1Py9TKSTPIfSfUaJmJE58EI8jzOwAm+LDs4zDZvFHns17itpu5ZHcGyu7GxcnfwM5+r2Vmy3FWYajU0ZE6G52XiP4waxfdsnRsxjdexmp/o9derhuNTWyEr9dbFAPKfAdgZeVr5ibYZM99P+FPF7P2/RT6Y9zc3EexxX4U+xiDtB7Fv/EiMoz4A40j1QUFfLx/gNN4oftqHAZhBvJOG3VhFagUz3O39+stvWop9M+5qrxHscl4j0/gVOSmVLUgMv1Hlna6qfW9Lu40ZPyg7g+Fz9LJGuDuOmKkIrkul+5y9NdqXbqRIy7WtuFO//GJnzzxIp92exR92XyrfifTEPLRTn3LVsw3W4Ep/V8TGE5eLMewV+zNVvxsVie3SqmOvzrBEHFN3kmnTBiem+wOjC6wfcmXvnCpFmd0y0uBIaxXsMc8XW5CDOLKhfLEZS0UHO9PTuuyXtLzS6981v2aaIEVq2yt1fJr6ETHtf0eoGuoZz9rPEQq9elqxCpv0vvyzeHeee5KzeouJF8TWcP9FCesztIg4Le6yjq/GeIf6Z8VJB3ciiY303hPSQmfhWTJO9pCfxvhT3ilX7HHH+v1HM0x8pPiT6PzFfTBOn9MD3pIr3cjH6DuI5Y48a+3Sefrz79OnTp08V/gXlMEd78lkoyQAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle x \\left(y z + 1\\right) + y$"
      ],
      "text/plain": [
       "x⋅(y⋅z + 1) + y"
      ]
     },
     "execution_count": 90,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expr.collect(x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 91,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAH0AAAAXCAYAAAAm70AZAAAABHNCSVQICAgIfAhkiAAAA9lJREFUaIHt2ktoXFUcx/FPUlsSI0QFQYsUkVrtxio+SsVIhKrgRtG60IVcLRSEuqh1od0YN9aigmKpqAujSLFqfS8kKFI1+KCLQn0sfJAqWmvE+kCLWh+Lcy4zmczMfcwkV+184TK5//M75/z/59zzJPTo8T/hCXyLoaodqZBz8DfWVu3IfHAu/sItVTvSZdbgQbyFn4QOfTIjz/PYj2Pm1rXqmcAPGKzakS6zR+jon/GxfJ1+ftRtmlvXZpPEikfnoa5lwih/ZB7qKkqis3a4GKehL5aRp9MJH8g+LEgN/Q2CiVjYVQ32PozHtLtLOFyGjbG+jS3ST8dveLPOdqPg644WeYrGNxltrZ5duSLpDm/gk1hvEZ7CEqxuJViBP/GRui8D98XKyoygRLkvfGXM90yL9Akcxpl1tt3R1moDVzS+WzHW5NkX9WNZQdSR6N6MNyr/SF8dtfe2E41HURLfN8X3HWbPDHlIlAt2IX7FF03SrollPlBnGxI6fG9GueM6i++eqH8spz4lUU2nD0ft++1EJ+MQprA+ZngVi0o6mCgf7K6Yd3GdbQhf4oAQUMqyqJ3IKLNsfH3YFvVb43sREtV0OiHeb7JEm9XWrUkcnbPwKTPXvKxnPKO8u8xeg7eYOVJTVqmN2CyKxrcAj0f9lhzlT+luOzQyqlinfyXMguCoFqLpur/XCtNsHu7HsQ22s3CF0GhTDWl7MsqbjL8r8RzOwAa8E8ur51D8HcjhZ5H4FmK7cE4ew505yu92O3TKoFr7NOVa4dizX/iaHuqwwkT5ae246Eu6S35N2Iid3US7ONbzdkaZReIbwCvanyLykqhmeu8X4v2sleBy/C5shk4Qznh/CCOsLInOgv0Qv+C6WM62Fro+4ep1ukU6xeIbwutCg91UxvEGEtV0+vKo3dks8UJhmvscJ0XbmpjhhQ4cTHQW7MNqN1HTOL6N9tmoXdokrUh8w8LSchjXl/S7kUQ1nX5D1K5PDemavkKYxn7EJcLUR2jE3cJaNCLc+843k1gn3B9vwPdttDtxNS7Dp3X2ovFtxwXCMedUzc/jm4XLofniyvjAifF3ldom8DvhXqGRS4Ul8cV641JhO3/QzIuOlPRw/25JZxOdfeEjaufMrGPSIiGW9+psRePrF2aVdrvtAyXiSHTWDmMZPk01yTMsbOA6makr4SXhSz0vp/52oRGabfaONG4W2mKkakeKkG7ethbIMyBck748Jx79dxjE18IS9q9nCW7Do8Ka+YH8l0MpF+EOR/Y/USwXloRTqnUjH+uE0X0QT5t5BdujR48ePXr0aM4/QsdNtcQYJM4AAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle x + y \\left(x z + 1\\right)$"
      ],
      "text/plain": [
       "x + y⋅(x⋅z + 1)"
      ]
     },
     "execution_count": 91,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expr.collect(y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 92,
   "metadata": {},
   "outputs": [],
   "source": [
    "expr = sympy.cos(x + y) + sympy.sin(x - y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 93,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAUwAAAAXCAYAAABgUHbfAAAABHNCSVQICAgIfAhkiAAABw5JREFUeJztnHuIVUUcxz++KrMwySLF6kZmVpA91SChQCokKnpI9kddsqTsQSYVmtZfSVmW0cMeVlsUaWpFQYlUumZlPkowMwJlN9Pro9QIM027/fGb45577pyZ85jrnrX5wHJ35zcz53e+8733zMw5d8Hj8Xg8uXgL2Ar0yNC2BFSBpoLkE3A+ktdoJxkdGuTV1aZpGs1djHEeSnjfdhSK5FsuAP4F7s+YTAm3xsubT5gPgApwlIO+OjqudLVpmkRzl2OclRLetx2BIvkWgAXATqB7xkS6AQOBPhnbu84nzGDkTTHRQV8dHVe62jRNornLMc6K923HoEi+ZQDy6f1KzmRc0Yh81gKtQJcMbcuIiJc4zKc9cK2rTVNTvGiec4H3bWNod992jlS4FegEzNY0vgr4HJmm7gE2Ac3A2Ei9EvVLm3BZCZgF/Ab8DawAroxJ2JQPyNWmClwbKe+kjlUFHo/EZgEnAcNj+mw0g5Hz2YjoWEHOY6Sm7khgMfAHsBtYDUwADtfUTTo+YNa1EZqa4rYxzkvRfDte9Tk+pu3pKs/FkXLvW/e65vEtICbYR/1m6hiVTAX5dJ8CzASWAcsjdUvEG28hslm7FHgGeBMx337g0hT5BAxSbX+k9ioxTR1PdyUarmJPxfRpoky+K/XtyPnsAebQpuMqYFGk7hR1rG3ADOBJ4AdVtghZQgakGR8w69oITU1x2xjnoYi+HaL6nBOT8wLV9uxIufete13z+JYeqsPVmthKRKzjNbHekb9LxBuvCjwaqX+5Kv8kRT5hmlT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4MSYuIky2a/UIM+z7UcepXgPeAx4CdEwOihPqGNtAV4ApiKzvirwJbV3rNOMD+h1baSmpnjcGLugaL4NczNtN15uM9QL8L51r2se3wJyMpuBbyPldyBfRl+PfOpvB74HHgSOjtQt4c54unz6q7Id1D/cC20Pmy7VxHoiG7gfxuRho0w+44E8qzYPWV7sRW5SzAeu19S9Ebli/onc+FgDPEz9xnea8YF6XRupqS0e5zkXFMm3UYaptsuQ5aYJ71vBpa55fXuACeqApg3og4nLfO7BPFP6P+FKV5umSTQvmudcYDunj5BZ24UJ+vK+bcOVri58C8hVoBV5Mr8IuMqnO3JVnJs7o0MDF7raNE2qedE85wLTOQU3JJ5P0I/3bS0udM3sW923F/YB3yFflF+B3CFtT1zlcxqyBzOV+Ofq/k+40NWmaVLNi+Y5F0TPqQ9wJ3AL8jXLn5B/UmE7V+/bWlzo6sq3Ho+nQQT/aGIHcuOkr7m6JyFeV4/H4/F4PB6Px+PxeA59/gO3FRU8J5xvKAAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle \\left(\\sin{\\left(x \\right)} + \\cos{\\left(x \\right)}\\right) \\left(- \\sin{\\left(y \\right)} + \\cos{\\left(y \\right)}\\right)$"
      ],
      "text/plain": [
       "(sin(x) + cos(x))⋅(-sin(y) + cos(y))"
      ]
     },
     "execution_count": 93,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expr.expand(trig=True).collect([sympy.cos(x), sympy.sin(x)]).collect(sympy.cos(y) - sympy.sin(y))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Together, apart, cancel"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 94,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAHMAAAAfCAYAAADUdfLHAAAABHNCSVQICAgIfAhkiAAAAkdJREFUaIHt2r9rFEEYxvGPYiNGkIBgFwsrEQyWQuRIlUa0ULAQzB9gaWOwsBchpgjYbcBKFARRG4uAIoKFioWFBIJFRIQgouDvWEwClzW57OV2Zy6b/cIUO+zs+zy8O/Pu7iwNDSVxAvexgCWcSSsnGpX43lnGRXpgD17jYmIdsam97+00M9upzcxsKJEmmTWiSWaNaJIZGBdqVyutjN5oklkjdiWOP4BDbccHMYxFvE8hKBK19N0Slrd8yyLrGBd3mW2pwHfqmTmLHYk1pGBWBN/z1r5j1mu3qhZUAfO685ilELkZ8jNzDt+7GL9QopZYTGJfrm8YpzAjJLudVxE09RXd3OmxWjeM21zNTO1xVSurZm7Hukef+W7eM2vEVkzmZbzAF3wS9gWPJFVUPYX2P/slmRmuFjy3hWkcxyh+4zEGK9BVNZlivqPvf57FDwy19d3AO+zfYGymeDLzDOAPTm5yfK/E9h1lZt7BG1xZPr6EcxgTlsOq2Cv4WKwwRidS+f6PMr8ALWECD4T31QlhGZwrMcZaTArvgs8rjrMeqXxH4ZlQx8Y6nDOBr23tF37m+kYKxLqGD1Z/tE5FLN/Rfq8ZxTf8xbEO5w0KCVhpdzGV69u9Qazr+IjDvUkuhZi+oyTzKD7jAu7hURdjM909CEzpn0TG9E2HZJZVM4fwUFj2ZvBSqGMjeFJSjBWmcR6nhYeeA8v9K8tUTGL5jrb/OYi3uJnrv42nBa+RKX6Hrvdtsuj4sojpu2WL7+g0NDQ0NDT0E/8A+/0KYhWpxaIAAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle - \\frac{1}{x + 2} + \\frac{1}{x + 1}$"
      ],
      "text/plain": [
       "    1       1  \n",
       "- ───── + ─────\n",
       "  x + 2   x + 1"
      ]
     },
     "execution_count": 94,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.apart(1/(x**2 + 3*x + 2), x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 95,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAADgAAAAlCAYAAAAXzipbAAAABHNCSVQICAgIfAhkiAAAAsBJREFUaIHt2EtoFVccx/FPY0XUgBgUwYUKKoKPGIqClCrBjYK60oIUwY26KEGLZGULuhUXQYvQ0hauLkMQ8YFotkXbRRGrtOADQZpIq0hRN7GPuDhzdZzce2fu3MlDmC8Md87/vH7/O3POmf+fqckmXMQwRrEr70BtRSnKSAXHMrSbjVvoaXXCPA7+gcMJWxdGsLJVQRFX8BXOtTpQHgdvYH3C1ofv8FurgoqmCAd3Yi2OFqJoCvCxsPA7MAMP8EWdtkfwMnb9g1cJ28aU+VraZD7M0ecXQeQ6fCSIPl2n7Tfoj5WPYwinYrahHBoyk8fBEdzEDuzFZ4KTtXgWXVVeROX7OebNRR4HCevwEAZxqTg5b2jHslh5ibBTP8OjcZhvDHvxL1Y12a8i2znYLay95FVpcr7cDKq/7t5b2rBA2BkfY+7kyimebvyP34WjoqSkpCSVD6Lf0UlVUTJxzMWfWDrZQmowYGwg3jQncKZ1LU2TJUfTKXyrzokbmwl4Z2E/vs+nsSYVxeVofsVD7Ikb4w6m5Vq2CV8yPybafBq1WRyzncQ9zM8gPgtZczQXhPDtDXEH03ItnwjBbnLHHcDtSAD0Yje24kkm+cXxs+DDzKohHg/ewOexcjXXUn3flwhrIMmo8AF+WUhfHMHm6H6iGcZ0LKw1f1qu5Sq+bTD4dSFG3NqgzXjnaJZH9aurhvgTTMu1PFU/RNosPO02/NVA3HjnaDqi37pL4yd8jefYnqjrxZ0afdbibyHKPy9sCFmpyLaLxmn0BPdJ+YP6hJ3yao26NfgP82K2xdGAX0blzqh/2mtWpSKbg+3Cjt4lONgb3S9KtDuLHxoNlJZrue7tWdQhBL/Jddlv7FFSj4ricjQzhTdvQ6OB0nItW3AX0zKImmh6cK1WRbO5loPePdSnCgewolZFtzLXUlJSMk68BqiRsvRCPK/AAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle \\frac{y + 1}{y \\left(x + 1\\right)}$"
      ],
      "text/plain": [
       "  y + 1  \n",
       "─────────\n",
       "y⋅(x + 1)"
      ]
     },
     "execution_count": 95,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.together(1 / (y * x + y) + 1 / (1+x))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 96,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAACUAAAAfCAYAAABgfwTIAAAABHNCSVQICAgIfAhkiAAAAT5JREFUWIXt1j8vBEEYgPEf0VFJ1KfQ8wXI5SpKCYnPIEqVKDQKUVHRnfYiGsEHIFpEoUAjoSDR0PiTnGJXMrk4xt3KIvskk52Z7PvOk5nN7Ms/ZATbuEEdE1kk7WwzvhsnmMnA5Uf4NTv1IxRSsRRSsXS1Gd+DgWDcjyHc46rN3C1TllwFja2al1BB7nSkz3quFgV/hKj6K6sbvYqFiPei6q9QahJPKAVzKzhH33cMP2EP89iKldrEaRoEs5jCKO4ykooi/PfVMYcdXKb9StrPnUO8SnaoGXN4DNoLnhvmhr9Yp+mH3lglVDAoOdbbTxKuoRaMl3CN1WDu+guppoRSg5IPcBrjWMRYk7j7tL3zkI4vWhX5SKqEXSxjA0c4lhzBfhYLpUTXX704w3pDghoOIherirunyor6qyAH3gBSW0s1V+uiwAAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle \\frac{1}{x + 1}$"
      ],
      "text/plain": [
       "  1  \n",
       "─────\n",
       "x + 1"
      ]
     },
     "execution_count": 96,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.cancel(y / (y * x + y))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Substitutions"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 97,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAABsAAAAWCAYAAAAxSueLAAAABHNCSVQICAgIfAhkiAAAAYJJREFUSInt1D9IVlEYBvCfZksFYoVIg2uuDkKLS0tDuCQuLQaFBEkoDkkQhEMhtIQhRCAtLRIEQVtDf8whggaVFgcpEERIRTTyTzWcV7h93e/jfvB9tPjA5dz7vO9znnPe897Df8IpXMMLLOIHNjCDq2ispdl1/MYynuE+prAe/HM01MrsPHr8u4M2fA3D3lqZVcLtMJvIcCPBjZTRnMVPvDsgip7Dbox7GW4mxnNlNBM4gsGCHqAJc9IuLmT4o9iWSlyKvsh/WI0RPAjhq5zY24idyXDH8Q0raK7G6GZM9gUnc+L3In4pw40Hd6UaoxshWpA6Mg8XI2c8vjuwg1lV/CZDMckcWivkteCXVE54jX10FjW6FUafcbpA/gK2cDl0k0WN7oTgk/wzysPj0GxitZKuKfPejzGpDO+l5ijFEp6WcB8wgBMYxvciK7wbK6z0vMnRdUfsoxreneXwUqpGV72NDpriUb0M2jGKJ9JFO49j9TIbkHazhml/X1WHqD/+AD1fXtT6FituAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle 2 y$"
      ],
      "text/plain": [
       "2⋅y"
      ]
     },
     "execution_count": 97,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(x + y).subs(x, y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 98,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAE8AAAAYCAYAAAC7v6DJAAAABHNCSVQICAgIfAhkiAAAA+9JREFUWIXt2F2IVVUUB/DfjJnaGGZJkUXchzC1CCNNi0aKRKOih6SXiCKCiEAopTCJ6qkPKCySoi/IILLUPqlIFJtwwkwpMrEoIzOyzMY+SLPS6WHtwxzPnHPn1lzmvswfhpmz1tr/vfbaa6+19zCMIUUNvXiuiZzPYw86msjZCL7DwoJsGg5iavo+V6z3xmZMWNPc4E3HYf0XMRRYiRcLsvVYVpC9it0YO9gJR2IyTh4sUcIa/IIxTeL7L1iIr3Lf89GDEwp254mEWTJEfjWESSLrnmrR/BeIoByPUdiBWytst2MnRlSRXYl1IkUP4nt04ZacTU3/Y5uX1bACe/EnNuOKivkeSOMuKdEtSrpFFWPPSD6+X6Kbj3eSD3/hS5E1xYWPShxzsRifi5NVhnuSP/PKlDcl5W6RCffhGWzCRzm7murgrReFfyOWYrkI4CFcXDLnZvyjvFHMTJwrKxazJo09OycbIWpYrwjYE3gEXyTZ8hKejXgMv6neZJiTOB4qU24Ru3BiiW5C7u+a6uD1ih3KY16Sv12Qd4jFb61wdiT249sS3dWJ89GCfFmS34+jClzdSTe1MGapKB3vVviRYVwav6lMuQV/YPwAJDXVwftGeU3YKY5QHpPSmDV15upKNhNzsg7swo9iQRlmiiC8VsGVnawbCvLrxSaeWcePDAfwQ/aR350X8DC24aXkeDd+aoA0wyfiiBaxC+cXZFlH21eHrxuzMQuvJNndOFUE4dec7QK0iWy9t4TrrPS7rSC/Fk+KdQ+EHpxUpbxO1IBDYpcOizo2PWdTU79hlOG9pM9jWpK9XsfZy5PNg+l7smgAH+gfhD36Ske9nzloF0FYImr8QKctQw9+H8joOFyGp0Ugf9ZXC2uaE7yJSbahjh/jxQZ2pe+1yZ9zCnajE1eXxnBR4t0uriuNoD2N2dGgPXg2OTY/fdc0J3htIlsGKgvbRC2+JnE8XmIzJukaOXr/F1PSHKszQXtOeakja2CGLOP2N9mZXnFHm4DT69htwDGiLu3FXSU2B/Cp6KRXVfBcqM4FtwHMSr/XZ4J8sFaIO9kG0TXb0IkZohOvHcTEVVgtMnqeI59JeXSLTjkWt4m6U4bb8VbiXCuC2Y5TxON+JE4bhK9zRckordE3iwfw1yLLevAx7sCxObua5hxbOFq0/g/rON2p735VbBJFzMCqxPm3yNStImvLXjGNYpzI7qprUMtwpwhOsQlkeEPs+Iwh86g/FggfO1voQylGi0v0myW6rEkU/0U0lBgj3virWuhDXcwWz7oOUZcWi2vSQXwmGkarMEVcumst9KFhZM+ofXjZkU+zYQxjGMMYRovwL5CgEtgtR+0TAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle \\sin{\\left(y e^{y} \\right)}$"
      ],
      "text/plain": [
       "   ⎛   y⎞\n",
       "sin⎝y⋅ℯ ⎠"
      ]
     },
     "execution_count": 98,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.sin(x * sympy.exp(x)).subs(x, y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 99,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAFQAAAAYCAYAAABk8drWAAAABHNCSVQICAgIfAhkiAAABGFJREFUWIXt2GmIVmUUB/Cf2qJNobYjrSSWFtHiUlESJO30ISsqwpAyogUqIUqh+tKeWGiLZR8KQkpb/WDZOm2YJhUZLWbRpmk2VlJmZdOHc17m7c697zsmzBTNH4Z37jnn+Z/zbOece+nF/wYPYw1autnv17iqIDsEGzEinw9HOy7oxri2CCPxp84T6w7MxZyC7GXMLMiexCps3x1BbSkW4gcM6AHfV+HTuufxaMNOBbvR4pRO6aa4/jGGidN5fw/5P0os1I7YFitwRYXth/gC/RoRjsaj+EbkjVXixJxVsDsLr+JHbMD7uDaDKMNpeDH5NmIlWnFJwe6WnNBxJRyTUze5wsf+yf1qiW48FmAtfsNycbqKi7FtchyPa/ARtq7wd33Gc0KF3iT8kYRzcRNm4128Umd3UxJ9h3txO5al7JWSAC5K3Spx8mq8i7GkYPt2xlBWjMYkz9yK+Bfm2IPrZP1ETmwXi3gv7sTHKXuohGcRZuAnnFrhC8Ylxx1lyhH4XeSLA0v0e+TvkUnyJXav02+F+crzylKxSbuW8O5c93+LWJD3KyawNX5J30Wcmb7vKshnpvzmjLGe643UjSiMmS7SznMVcdQwMMcvLlPOSOWVTUgeSLuLSnTDsAmfFeRL8TMGN+EeltwLG9i0ps2QOlkLvsJqMckaxoiFeaqCq3ZzJhbk54uNLTtYRWzAt7WH+h07In8XNCE4LH9fKtF9Ivq4fTFIVGp4BNPwgcjPreJ0fFcYX6uk6xr4fwNjM94nUnaduEETRU6v4XL0Eaf6hhKug/K3T0F+HmZlvM3Qht3KFMvFbu3QhODTtKtquBelfu+CfELqNqX+T9HfjayzOSR1Tzfwf0ra3JrPB4gi86bOC7MmbZv9jUNfsTBTRK5vdptqaMP6MsWSJD+gCcHStNuvQv9F6gdV6AfhZJE6NuF7Hbl1SI59vYH/wWIzWvP5heQ5tGDXP7ladQ3HJu+HonXqCvrmmBVlyq7m0NmqX7uGKs+hVXgwucbncx9xqoqpoIgPRE4+N8ffU2IzIHVdubb/FMPTx+NlyvoqX6x6dFT5WuP7OXap0/cTyb8dUwtjT/T3fF1DrSs4qU42L2VDq+dhVtqsF4u/Y4Xde2l3eoX+aE2a8iaYmPyXVRlMEidsIx7DjbhP9IYv19ndmkSrcTduE61OO17DNgXeH0QlnCd6tmmi1WhP7vq+9ZyUX9pgIhN05L8LG9gdLw5JO55Pv9NzbiuUt1+bgzmiG9izkdGR4givEcl+JZ7FGQW7s0WuW49fxdWaKnJXEReLjwmfiYrbhndwtc5FcBux+G81iPEYHf1fsRAVMUps5LdicdeKzZ+l/G2sqxgoWqaqluxfhWvFghULTQ3PiJs0qtsi6ozLRYzH9GAMXUZ/0S3ML9HVClHxc1p3YoC4ufN6MIbNxljx8aEFe4kPFQ+I/L4M2/VcaIaLF4V9ejCGLULtFXGdKChDGpv3ohe96EUv/ov4Cy9KNEl2dFHtAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle \\cos{\\left(y e^{y} \\right)}$"
      ],
      "text/plain": [
       "   ⎛   y⎞\n",
       "cos⎝y⋅ℯ ⎠"
      ]
     },
     "execution_count": 99,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.sin(x * z).subs({z: sympy.exp(y), x: y, sympy.sin: sympy.cos})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 100,
   "metadata": {},
   "outputs": [],
   "source": [
    "expr = x * y + z**2 *x"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 101,
   "metadata": {},
   "outputs": [],
   "source": [
    "values = {x: 1.25, y: 0.4, z: 3.2}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 102,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAC0AAAASCAYAAADPNlfiAAAABHNCSVQICAgIfAhkiAAAAXxJREFUSInt1sFLVUEUx/GPkhAUBCkpbipDEBSCcKEQ+Ny5EUJctvU/aG8bQXEZunZhm/4BVyIouBFSItyI8MQIES0UwRRDFzOCDj3ffc/7XIQ/GGaYe873nDucOffyH2gYn7CEQ5xj9gb7CcxjG8f4hVWMorHC2JlZdYnjGl7jCD/Qgc94XyLQKb5iHbt4hB5042dcb2dMumpWP9rjyxSUP+mHJfbHou90xoQrYtUnBgvYiEZZ9KfE/pc4t2fkVMRKk85Lg3H+VgvWgxyg8AGP8USowbcxyPhdswrK1/SldqLt5ZhDc8XpZmTlVR4twuVtwRDahHb15q5ZBdlPOtVznOB7Fb5lWbW6iFtCv+1EU96sWiUNrXH+mzfrNkl3CHWXql74IDzDMn4nz19F34ZqWWnLexeHK5BezMT1ntCSYACTWMQm9oVb3idcnh2M/COReaFOX6J4Sxb46Hq7SUfxim0XpoT/lT2c4QArkfO0RIxiZL3IgXWve6W6AOZVd7IKBf1yAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle 13.3$"
      ],
      "text/plain": [
       "13.3000000000000"
      ]
     },
     "execution_count": 102,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expr.subs(values)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Numerical evaluation"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 103,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAMYAAAASCAYAAAAANKFkAAAABHNCSVQICAgIfAhkiAAABpVJREFUaIHt2musHVUVB/Bf60VpVSS+2mgUyiMptgZFQTEClwrGitWC1g9GxCd+IAK+AFHj8RURTSMhPkIgESUxRqQQEdErQQt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ggkmmGCCCZrhfzHU0qJXKQKqAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle 4.14159265358979$"
      ],
      "text/plain": [
       "4.14159265358979"
      ]
     },
     "execution_count": 103,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.N(1 + pi)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 104,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAoMAAAASCAYAAAAgy9RBAAAABHNCSVQICAgIfAhkiAAAC/lJREFUeJztnWvMHkUVx3+tRWmVi6C28QblooXWgCi1eIGnXBoR2xQUPxiBqiAqEYhoEdDwxCsCISBekOANMH4QKYSLCDbVQtXgjUAtSpE+CsFaWiwtbSnSvn44M3n33Wdnd87Z2X0Ts//kzdPu7M6ZOf9zzlx2ZhY6dOjQoUOHDh06dHD4OrAUeBzYBjwN/Bm4GNhbmdf7gauBe4FNwAhwo+L5U9wzI8DpCWUMMvnm/9YW3D8B+AjwO2AzsBXRydnAiwru39uVdwnwKKLHZ4D7gI8CEyvK9y7gZ8C/gO3u927gPQnqYuFXK8PjBFfuJ5ysx4CfAkcE7tfoeVFJmfzfjpoyPDQ6s3Jv9TutjvOI8TGIt8k2bV9bF4uO2+BFK8Oi40W04y+DkvzLYsVrge8DTyK8D4ArgZcX3Gu1MYuvtOFf2jZMy8kibNzXab9j/bjpeGyV00a5FmHjZVByf5GPRfM4Iff/54E/AauAdcBLgTnAWxFHneMqG4MHgEOAZxFnmgH8GPhQxLOvAx5CFP8y4AzgukQyBsCeSLDJ41ng8ty16xGnXgfcBmwBjgUORgz+ZETBHh8HvoM4wDLgn8BU4CRgj8AzHp8HvgSsB253ebwCeLPLa3HNulj41coAcYzFwAbgFlefA4AFwCTgVIYNUqPnQ4GFBXJBAtHRwB3Ae2vI8NDozMq9hReLjrOI9TGNTbZp+9q6WHTcBi9aGRYdt+UvA/SxYn/gN8CrgFuBvwKzgbnA34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B8h3fHyDfsX0e+AeyhipV/S2+0pZ/VdVnkLvfEidBz722XB4aP246HlvltFUu0PFi8bE+9fthHTp06NChQ4cOHTp06NChQ4cOHTp06NChQ4cOHTp06NDh/w//A6Soj5NVgM3WAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle 3.1415926535897932384626433832795028841971693993751$"
      ],
      "text/plain": [
       "3.1415926535897932384626433832795028841971693993751"
      ]
     },
     "execution_count": 104,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.N(pi, 50)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 105,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAJIAAAASCAYAAACwy4dWAAAABHNCSVQICAgIfAhkiAAABOtJREFUaIHtmWuIVVUUx39O2svSMqupjGymh4Ro2Jssbg8UjXIqCZIGLzVQ0JPKXl/yQzEaQ0zY00JHKwizzAiqKTMIw4h0Cuw1pTd6OFOTqVNKk3r78F+nOfe4z9xz9rkjUfcPw76z1l5rr7vuOuuxD1RRxf8EY4BFwE/An0ABaAUOT6lnPrAK+B7YCWwB1gMPAkfEyMwEFgAfANuBIvBCgrMuA9qBH+ysjcDLwHkVtC2tX4YA1wNrgV5gh51xG7BfBWX+lagHutEP+BowD3jP/v+SeCe70Iccssj0LAA+Nl0/Asc7ZDqM3wt8QbJAmm/7eoDn7Kzldv4e4LoK2Objl6XG7za7HgM2GG05CppKyAwa8nZwzkP2bZO9NUJ/1OhPp9B1YAz9YdP1pIN3EXAycliO8oFUC+wGuoCjHLqKKDtltS2tXxpCZ48O0YcBK4yXr4DMP2i3DVdF6EOANuPNixOOQR6/QKozuU1ATYR3KPA78AcwPKXeKCbaOe+U2ZejfCCdY3tWxvC3o+yWxTYfvwSZ5WbHGeON90mEnkomasgclH4forQGtgCzgWeB+xyKBwMX29puNoXRC6wBDgbOzXjO5bZ+llEPQCcqU2dT+hQDXIh+6HdT6HPZ5uO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aystyle x + 0.3183099$"
      ],
      "text/plain": [
       "x + 0.3183099"
      ]
     },
     "execution_count": 105,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(x + 1/pi).evalf(7)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 106,
   "metadata": {},
   "outputs": [],
   "source": [
    "expr = sympy.sin(pi * x * sympy.exp(x))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 107,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAtsAAAAVCAYAAACXDSJFAAAABHNCSVQICAgIfAhkiAAACs1JREFUeJztnX2sHUUZh5/irVqQtsJVbqLEtteoBYxfoX7S3paqQSwBFPQPizcKSCQWgwoExJz6EasiKR+JQkRvsEajKCK1KAV7FUXiR6sBK4K0B1tp0RaKta0o7fWPdzbn3L07e2ZmZ8/Zc877JCd7787Mzsxv3pmdnZ2ZBUVRFEVRFEVRSmcEmGj6PdjR1CiKoiiKoihKdzDI5H70ROJwWIbnnwMrgesz3F4MfB14DHgaqAOrgedHTW458Y4yVYT072CEMGmWN/k91yO9IcQun5OA7wM7zPV2AHcC73AIm5fvo825W4G/AgeAp4BfAh8k2y5j0il78s13L+gEMA34AHAfsBfYD2wCVgDPcryGbz3qtnpXpKx94q9jt9edHukNoVP2NEp/tuNl6+Trv9uIeT89Fbl3bkfq9hbge8AbM/yOorr64NNPCbkX1XFvM/cj/eeVwKPpiBNGgA3GUy0jwmHgXuCFwG3IyPcCYDHwF+DNwG5LYosQK95XA6db3E4ClgA/Bt5ZMEwzxwL3I4X4POA84GsOaQ0hdvl8EvgMsAtYixjwIPAaxE4uyQnbKt8XAF8x19wA/A04BjgTmIVUnLNoeiqMSCftyTffvaATwM1IZ+UfwO3APmApcBxuefCtR91Y70LL2jf+OjAbubml+TdwlUNaQ+ikPfVrO162TkV1rTIxy+ELyP1yN/BD5J76UuA0YAA4B1jT5F91dce3nxJyL6oT1maOA4uY3M8GGtNI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CjLelQXe02HtJP8a0ToW0mpDrbAxZPWXwY2VLlWmSY/8/Ihu2LkfltV2SESZ5eiuwF7Bvv3YgQc7FvRJ4sNrjRIx0hYVypmk4Xm7BXIPORfmP8noE8YZ+HGHIo70ee9A8iT/YrMvzUmfqUWTWdElxtwzffvaLTeuSG8gDSoB2PLEh5Gnkd6PMFtZhUSafQsvaJ/yzkteoGZHRpL3IjOxUZQVtH9qeHq6QTFLOnfmrH26mTj/8YOpVNSH8nqyxuQfbRXmqucSvS8Z6PfG59GlInbZ8oV13tNh7ST/GtE6FtZi4jtJ4XdCyyDcoOZKP2R5H5RLZRmE3IF5JabS/UCp9460g+5liuNd+4b8N9U/KQMM3UyB8RqaJORyFPm1vNtXYjX8Hy+UBHjex8J+fzfuMZ16uiTj62UcMv377+E6qm0yeQL3PtQRq1rcgIRpbfPGrEHdmukk5JWn3L2if+RcC3kd1N9iCvYf+J3IDOobEbQJoq6QTh9tRv7Xi7dPL1H0unsvHt79TJLovpyDqM+5B8P4MswlsLvC0nftVVqGO3cd9+im+dCG0zocA0El9mI08XLtva9DOqkxuqkxuqkxuqkxuqkxuqkxuqUzmortVjnBad7eT3YMGIliGrNIdaeexzVCc3VCc3VCc3VCc3VCc3VCc3VKdyUF2rwSBT30gCk4fA5zB5Yv0u4Pry06YoiqIoiqIoXc3hyEeMmql1IB2KoiiKoiiKoiiKoiiKoiiKUpD/AwDXVQ8yyKuTAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle \\left[ 0, \\  0.774, \\  0.642, \\  0.722, \\  0.944, \\  0.205, \\  0.974, \\  0.977, \\  -0.87, \\  -0.695\\right]$"
      ],
      "text/plain": [
       "[0, 0.774, 0.642, 0.722, 0.944, 0.205, 0.974, 0.977, -0.87, -0.695]"
      ]
     },
     "execution_count": 107,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "[expr.subs(x, xx).evalf(3) for xx in range(0, 10)]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 108,
   "metadata": {},
   "outputs": [],
   "source": [
    "expr_func = sympy.lambdify(x, expr)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 109,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAANMAAAASCAYAAADBs+vIAAAABHNCSVQICAgIfAhkiAAABwpJREFUaIHt2n+sHUUVB/BPn6/Cq4IKWEgUUYsE2ibWXxU1gK0KopZUjT9iFBt/KxEwKorR9AZ/YBFBQlWCiEqIJqJSoFitVhCsoiIoAlpA+hQCWFt5UNsitD7/OLPcfXt37727fa/V5H6Tm82dc87snpnvzJw5MwwwwABThqfiQtyDf2MUX8KTatSxBOM9fjt2Qj/DMqzBXdiGf+JGLMW+Fd82De/AddiMrcnmRDymD9/elvumd5XI903ll+KO9F0P4Bd4J4Z61H8Evo97Rfvfi9V4VYX+q5P87vSuO3EJXlSiO6q6fe/7H/ClX5slXfzoxhfq87tvvkwrGM7CLzETl+HPmI8FWIeXYFPFS/OYh8UVsiOwEFfiNQ31MzyMG3ArNuBxOBzPF411uBhoeVwkBsQGXIEteDlmi058g+iMMhyIP4pGfDzejQsKOu/DVwUJrsLfsD9ehyf0eMcn8WlsxMpUx354TqrrlIL+slS2CSuS3cE4DsM4Hhfn9EfxREGeIv6FM3ejL3VsmvKlCb8b8+XHSfDBQvlZqfy8Cgfq4FepruMmQX/PCpvPJpuvFMoXp/I7RSdlmC5m33Ex65VhGn6Kv+ALqlemhVikc9Y+QJBxHK8vscs65SfYq0Q+vaS+HWJFmVmQLdD2M4/R9OsXu8qXpjZl6MaXuvxuzJdnJuF6nY23l5i5tojZvynmpnfcrb+Qqq5+hmdrd0weF6XyE7q863cVdZ6E/+BItFQPpm74RLI7t1A+JDpsC57cZ10vTHVdViF/UIQleYyqN5i6YTJ9aWJThm58acLvWnwZzgkXpudqQZo8NmMtjhah05ouDnXDe9Pz66pj2p3Rz7AoPW8qlB+QnsUZO1/2XBEKjeVkh+HzOAfXaL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ys/5SCzbHJZpv2tao5Fd9ykAivxsXZURG7wpemNtTjV5NLCY35Mkt7Rl8hsiw/S//X6bzvNppkT+/iQJ0Zso7+yWI2W6OdFr5Q3FAYF1dRZpfY/VpkhpYnm8vFUr5FZ5q3Ci3VgynLKm0XqfpWyW9Jid1MbVJfI5ICl6R6HhE3BPIYEofS4yKO/5a4XnS5IF9xj9ES4eoqcTNkmTjX2aadmSuuCrvKl6Y21ONXXX6zk3w5EN8QZHxY7D/OUT4rjeo+mA5TL5FQR38uviw2hhuFgw/gt6KTq2bRj4pT6zGRpFgvZqQqH8rQUj2YMlm339UV9e4jZsn1ou03iRsOHecYCdPFpHKdGFDbxf5npc4M01H4jriPNiYI+g8xII/XeU9zV/vSxKYuv6jHbyaHLwMMMMAAAwwwwAAD/P/iv24MX0vxBp5NAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle 0.773942685266709$"
      ],
      "text/plain": [
       "0.773942685266709"
      ]
     },
     "execution_count": 109,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expr_func(1.0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 110,
   "metadata": {},
   "outputs": [],
   "source": [
    "expr_func = sympy.lambdify(x, expr, 'numpy')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 111,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 112,
   "metadata": {},
   "outputs": [],
   "source": [
    "xvalues = np.arange(0, 10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 113,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 0.        ,  0.77394269,  0.64198244,  0.72163867,  0.94361635,\n",
       "        0.20523391,  0.97398794,  0.97734066, -0.87034418, -0.69512687])"
      ]
     },
     "execution_count": 113,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expr_func(xvalues)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Calculus"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 114,
   "metadata": {},
   "outputs": [],
   "source": [
    "f = sympy.Function('f')(x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 115,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAADcAAAAhCAYAAAB9VDPAAAAABHNCSVQICAgIfAhkiAAAA0ZJREFUWIXtmF1ozWEcxz/bam2GlZLImrL2cmFrNivyUixEXHhJy8VouWFcSF7mwpLaChdzo22l5WaIqCWakvISQ15WlkQoxlwMxTDMxe937H+enf95/s85Y6zzrdP5n9/r95zneX7P73cggTBUA10jTSIIkmPwKQLuDzeRP4FR/eVsyAMuA1+ATqAM+AwsGUlSw4Fc4APQAOQAy4EXwAAwySHOeOAI8Bz4pv67VHcc6AEy4uBZojGrXJwuAa2G7BjQ7Zi8TZOfBw4AtUABUAr8BLY7xouEs8prbBDjLCU0y5A3ARcckuZrnIsRdO3AeyDdIZ4fyjRPTRDjlcB3INWQ3wXqHJJu1qSbDHkusmpNDrFs6EKOTYrNcIWSGueRLVDZugCJVqttpFc+UK/Pi3z821W/ypAnAS2qqzd0+1RuLXZTkArZCEwnvJjk2ZyBOcjZ6gH69blWCaQAd5Cd4VdIioAfwCPCV+Kwcoi04uWqOxSAH+uBl0AvcAXYD3wi+N2YglwbDw15BvLFOi3+LUp2g36u0c8nfThkqr4jIL+4MEOTtRjyXJW3W/ynAn3IFVLNYGEy64AXfcAbd6ruqFRC2wz5bAZXwIY6Bs/qdWCMxf4VsiuA2NqvoJip7/cMeZ++pwWI8c7zXIVs82hI98T/Db/KFssrhKtIufdWXJBiNQBcsxCtUP9utT9qsU9W+6cWu7iRBHwEHvvoeghfFRPLkFatE5iI3GH9yDXihwLkRzjjQjSW+S1PE53w0Z9WfU4E3Vxk+z0DJqtsjdqfi5Jzo9pUuxBtZmiPaUOFJtpp0W8x5EVIS9aN3K9e3FafeT4xW5FikuVCtIPBLj4oDiqRch99KlKyb3lkOSrrBQoj+IQu6ZsRdJlIIYm2slHnt7XAVyDbY98APEHOhSv2KNniGHxNbCX6qlrntySkbWpW+x3AW4Zun6BI0/htMfqHkA68Rs6xL4LMb4uRqrUbqYalcRKbj/Sb8QyrBUjfOs3PwGV+u4Ec3KVxEPorCHUoxUgX/sDQlxD+Z9BCpKIlI3fVf4Eg81uoTFciVcllIh9R2Oa3bKQp3av2hUir41ud/jX4zW8TkA6l0bA/hb0/TCCBBBIYHfgFNIvyexn5aWAAAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle \\frac{d}{d x} f{\\left(x \\right)}$"
      ],
      "text/plain": [
       "d       \n",
       "──(f(x))\n",
       "dx      "
      ]
     },
     "execution_count": 115,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.diff(f, x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 116,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAD4AAAAmCAYAAACcRCiyAAAABHNCSVQICAgIfAhkiAAAA8NJREFUaIHt2F2IVVUUB/DfOGSamVBUJE0GDaM+6GBOQmIFJRlFPfRBSISF9FJTDxF92EMSgUL1YC+hQQy9WFEUSBQTRPRFmVI6UEQUWdSUPlhBTWVZD2tf5ni8555775yZW3H/cLjnrI+9/+eevddae9FFy+jDm/gE+3BtR9nMIM7CYLo/A9/gpM7RmX4M49M68v04Z4a5tI1ZbfgM4uOcbAgniK/+v8Vu3Jd5Pk3s89WdoTM9WIw38BvGsAq/Yl3Sn4i3cHNH2E0TBvATtqEfV+EA/saZ6MFObJ7CHKfgCXyFP9LYtdX0DA5i3hTGX5nG3NiK0+vixbJ4GuPpfg2Oiv1eu5a1SGxXIvYKHhF/4lIRM47i7hbHq4eXBOeTmzHuS4QuyMl34NUKyMCSNMdrdXSj+BFzK5hnVZpnUzPG1+BPzM7J92JLBWTg9kTotpx8QHztHRXNQ6TfA+gtM7w6kZqfkV2SZDdOkcR1aZx61xJsTfeXFfiPJn2+UuzBSNJtzekeSvJ1SrBQRPLtOM+xgW1xmXMJVou9fBBH0v3mRK4Xe8RqKwpqg/hLpNDsF3w88au3UtYm3WPNELwJX+OwqMkfxi/aK3ry6BVpcX9OPk+89FiJ/4h4kVvS86b0/FwBvwVJv7stthViWSIykpMPJPloif/ZmBBpcNhkkMzHpCwm8H3rVKvFBkH2rpz8QpNfrgxbTMaGd5UfkL4VqwnVLNt2cH76/Sgnn0i/c5oY41DmfqPYOo0wNzN+x/C2SFnzc/KF4gu+U+K/PvmPJ/snS+xnJfsv8oqi9FL1RaSdn/FZHYI9ItofqqOr4UpR3o7hdJGjj4hUWISlaf4XG9i0jWY7MosTiWcL9C8kfX8d3RqxpL8UjRC4Ptm/3IDbrclmuIFN22i2I7M+kbi3YJya/o6cfFCUseOitsjiw+RzUcGYO0Vg6yumfzyKOi5lKOrIPCpIri3wmy3SzgcZWX+SHcbyOj61AuX9OroFIqg1WhF18ZTjT2llGBJ/Vk+rkyU8IF5kRZv+Wdyp8WooRL7jUoYqOjJzRIm8awpjECnsOxE3GqJRx+UG/I5FGftt+FxEV6rtyFws6vepNCKWinPAuY2Mmum47BFLH+7BDyYDTRUdmY6grOMCl4uceb/IxUMZXRUdmRlHKx2X90RquGIGeE0barX6CnHG3ZfTr3RsD/1SkU9niQrrP49mOi61AmKDyIlV9d46irKOyyJxrHsw2S8X+7nl3PhvRFHH5VRRjGzP2T+v/BTVRRdddNFFFzOAfwBUqBSdCLrxOQAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle \\frac{d^{2}}{d x^{2}} f{\\left(x \\right)}$"
      ],
      "text/plain": [
       "  2      \n",
       " d       \n",
       "───(f(x))\n",
       "  2      \n",
       "dx       "
      ]
     },
     "execution_count": 116,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.diff(f, x, x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 117,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAD4AAAAmCAYAAACcRCiyAAAABHNCSVQICAgIfAhkiAAAA9JJREFUaIHt2FuIVlUUB/CfCjKTOQNBRJY4kMyMUE6mGUURlFR0e+hCSISF9FJTDyFdDEoi0Kge7CVUCOnFiqJAorILQWWOJWVGElFkUJY+WEaN3XvY62O+OfN953yXw4wD3x8O55x12fu/2fustc6ig5awE3vxOR6aYi6Tip64z8KHOHsKuTSFmS34DGN/PB+N++y4pg1aWfgQPq16H8EhvJWRH9coY+Hn4TTpmJ9ZBqnJQNHCB/AOjmEflkuLy+7s0bC7omyCU4F+/IKNWIircAD/4RT04uSw7cLbuLrJOXrwFL7FnzH2faF7VvqE5rS6ACyNMVc34/QmtmVkz+BgPPdhDz7TejrbHsRexaNYh0VYhn9xTwtjZvGyxPnERoznB6FzM/LNeK0EMjAYc7xeQ7cDP6O7hHmWxzxrGzG+Fn+bmKL2YH0JZOCOIHR7Rt4v7fbmkuYhpd8DUr2Ri2uC1Nwq2cUhu6lNEtfHOLWuQWyI50vr+O8I/XUZ+QxsDd2GjO7hkF9eRG6eFMk34QzjA9tAkXMBLpC+5UP4K57XBblZ+Fg6bfWC2hD+wRfG7+CTwa/WSVkRuicaIXgzvsMRvItH8JvWcn8Ws/C7FBirMUda9L4C/63SQm6N97Xx/nwdfr2h390S2xJxVhDZmpH3h3xHgf/pGJXS4LCxIJlXNo/ix+aplotVEtm7M/Lzje1cEdYbiw0f4IQC+++l04Ryjm0rOCfun2Tko3HvamCMw1XPq6VPJw/dVeNPGd6TUtbcjHyetIPvF/ivDP+DYf90gf3MsP86q6iXXsq+SGnnKL6sQXCGFO0P19BVcKVU3u6TSub9UnYYzPFZFPO/lGPTFhrpyAwEiefq6F8M/cIaugulI/0NTg3ZDWH/Sg6v28JmOMemLTTSkVkZJO6tM0ZFf2dGPiSVsQel2qIaH4XPRXXG3CYFtvk53CeguuPSKLql8rbWwh+XSK6o4ztbSjsjVbKFITuCxTV8KgXKrhq6Ximo5Z2Imthi4l9aHkbwKx5rdqIqPCAtZEkbY1Rwl/zTUBe7jf0jN4oevKH1jkyXVCJvb9G/gm78IMWNccjm8byOy434Awuq7DfiK2MNiQra7cgcwy1S3d5OI6JPqt3X5BkVdVxmBJEtYb8GPxkLNGV0ZKYERR0XuEzKmfdLu7qsSten/Y7MpKOZjstOKTVM68Zi5RtfIv3j7s3olxrfUb1EyqczpQpr2qORjkulgFgl5cSyem9TiqKOywLpt+7BsF8sFf1N58bjEfU6LidJldumjP0Liv+iOuiggw466GAS8D/90RhXlOx4jwAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle \\frac{d^{3}}{d x^{3}} f{\\left(x \\right)}$"
      ],
      "text/plain": [
       "  3      \n",
       " d       \n",
       "───(f(x))\n",
       "  3      \n",
       "dx       "
      ]
     },
     "execution_count": 117,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.diff(f, x, 3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 118,
   "metadata": {},
   "outputs": [],
   "source": [
    "g = sympy.Function('g')(x, y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 119,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAGAAAAAmCAYAAAA7mZ5JAAAABHNCSVQICAgIfAhkiAAABTFJREFUaIHtmmlsVUUUx3+lQIvViCW4ECgmEmglUNQqikKMEDQuiVHRoCKufAGioTXBGqOflBqXELcgialL0ghu6Ae1miguFZUIioAbKohWQKkBtRW09cP/XPp6e+fe+5b2lfb+kqa9M+fMnLnvzJwz5xUS+gVjgHeBLcDnwGV5tWYAcgJQaX8fC/wEHJE/cxK+AMrybcThwKAM9YpC+qqAIWgXJPQAW4AOYCfdz/oR1j+tt40aSJQBw4BbgVZgtLUXAe8B8/Jk14DkG2ABUAA0APfk1ZrDkHRjwFRgI/ADcAvw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0KJD3f5ciezlKp0bE0AWYjYLeUuRdVQHzF6L/qPAzC5W9dxBeyi1GF7XXQmSiuAQdf8fHlPcCr8sRPYYBv6BYFUhUrX+aTVSKAu024LaYuh5N6Py7wGHDJLT4NcBDwCPA+zbvHuJ59gxU8OrJL2TKkCOtREfrl0Rf6CrQt4UnugSiav1FNtlsm/wrVAuJowtwHkrV2oFTHTZMAF5CN8U2lLlsRoH4uIgF9iYL0PpagFV0LUNkTJxa/zrklfuAi9PQ9TKR+SgAvZ4Lg/sbcWr9DyMPfjMN3bHIo++058k2hjMQDWSiav3z0Rk+MaZuKcrdV/hkVxFdNkgI4C2Ukyf0IoNQAKxFt8m4l5OEHHEuOrO3kvy7YUJCQkJCQkJ/4n+hRodUqMmjEQAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle \\frac{\\partial^{2}}{\\partial y\\partial x} g{\\left(x,y \\right)}$"
      ],
      "text/plain": [
       "   2          \n",
       "  ∂           \n",
       "─────(g(x, y))\n",
       "∂y ∂x         "
      ]
     },
     "execution_count": 119,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "g.diff(x, y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 120,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAG8AAAApCAYAAAA7xHcRAAAABHNCSVQICAgIfAhkiAAABdFJREFUeJztmmlsFVUUx3+lCNSiIA0qhC1KoIgsCooSICoEjcsXXBIUxJUvQDQUI2BUPik1LiFuQRMDaEIEXNBEpWoUFwSpshbcUIpLBVQMqBRQ6of/Gd50OvNm3nvTvleYX/Lycu8999w7d+5yzplbRMuwE9gPHAX2AZe2ULsJMbAT6JjvThxvtMl3BxKyp6VeXgOwGlgP3NRCbSZkQXufvO723w2oAQa1XHeOX+JeeduAeuAnYIIr/xf7rwPeAobF3G5CDPQCSoC7gINAD6AUOMXKOwJfABfkpXcJkfkGmAqcBWwENgFb0YtNKDBGo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Isq/YfJRgvczCF7tx9hmQt5rDFEpMx0jY9YL2j5XAef6lBWj7drLOPRpahfBn1M6IAf+zSz75XAN2rLPjCDrGClPRZAtQddIVoQJ+l1jAA2693vXUBRAPcfS7VEwdXIGekEhoUNoe3NYgGKkXT167sV/BQ1CA7cSeBx4EvgYDdBewlfVGBT4bc6Psb1QwPx59LxbiWYXDADmAX0yacy5xgAKoi71lH9AauYUWfm8DPU6davRQ4Fezm5kKHQi9QI7AO8DV/vo7A+8iiIQ9chKrEHb7BkR+tQSTEWTaR+wjMahsZxJd41hJvCdS/Za5O2XWXoUsuY2un7O9b4o1yPGI/9pNjrwh1t+H2SkbCbcVThhCbvGMBLNmi5oe9wB3B2DXjdrkCl8RbYPcaISdo2hPdqnx6PV8RX6tJGrXofLULThKHB+Vk9wAhPlGsNaZAjsx//cyVav4xBPQX7M25l0PCHaNYYn0MpYFaPe3sjIuM/Sg62NtP5MQlPCrjFMQWfSwJj0dkHO/EKP/DLCI/0JGfIuCjcltBLaID9pLgrSRonZJRQIl6AzaDtNQ14JCQkJCQkJCQkJ6fkfnaSz40eqcREAAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle \\frac{\\partial^{5}}{\\partial y^{2}\\partial x^{3}} g{\\left(x,y \\right)}$"
      ],
      "text/plain": [
       "    5           \n",
       "   ∂            \n",
       "───────(g(x, y))\n",
       "  2   3         \n",
       "∂y  ∂x          "
      ]
     },
     "execution_count": 120,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "g.diff(x, 3, y, 2)         # equivalent to s.diff(g, x, x, x, y, y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 121,
   "metadata": {},
   "outputs": [],
   "source": [
    "expr = x**4 + x**3 + x**2 + x + 1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 122,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAALUAAAAWCAYAAACG293pAAAABHNCSVQICAgIf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ls1GIZRpaFnSPeUD4jKrAvm3KUsUOc5W4Q9fCs6qcyg1nvHDws1srT1D83z6t1INqsJiM1/kQtK8s7U6yLt6X4x4t2rgqZ1mwUifPkHhxfIW4w652XbGzGiQ2kL1prZgCXH8PxVJVrQ8q8Ot1f3yffdHFEt1lsrLaIbznGFeB0PTKt69Q7ku1jy8IHs967Uv6NKj+s5bRCa6YNG8VKlFReU18gpqKvcXIKm5HSvpynoCbJ5K+gceIkopwj9L58WVMWN5j1zk9512vsg6pWac0MQKcedkjSxpiIV8U3BJeI6Yl45bperJsmi9H9cOQy8ZbvffHW9CexUbwQp4sTkVv6pB/Mem/Se6q1WmwSy+nWu1E7nLVenS56B6VJen3fKY5o61Jy8Eg9RjT6bpU/Gb04pV/bpMPNksn/1I/HY2JzslOc+uwV336UHDyaDXa9JfX3Se+ltK3WmunfSF1SW0d3TrsdOnTo0KFDhw4dOnTow3+1M84x2UMa8AAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle 4 x^{3} + 3 x^{2} + 2 x + 1$"
      ],
      "text/plain": [
       "   3      2          \n",
       "4⋅x  + 3⋅x  + 2⋅x + 1"
      ]
     },
     "execution_count": 122,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expr.diff(x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 123,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAJYAAAAYCAYAAAAYuwRKAAAABHNCSVQICAgIfAhkiAAABTJJREFUaIHtmmtsVEUUx3+tiFRqUERQozExQFBRVAjaSLWCiMEYFTXRT16CJCbii0gQ1LAxKrVQXygmfNBi8AOxDRo0QI0JWohoG0Gb2PiqqwZpLQholCit64dzNrs7vXP33rt3d1u9/+Rmd+c85pw7Z2bOnFmIESPGIKwA2oHfgD5gKzC1rBbF+E9gB7AQCaaLgS1ADzC2nEbFiA5vAL8Ao8tsRzUwANxUZjv+L5gOpIBFXkynA/cgs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9zSjvRi+OpQ+sC5QvhYbwxPK0IG/i9xm5bcVJTcp/SmjfS4S4UfIXcpnIdtAN3I9A3LFkALe9mFPoXAINyhTkNOoiUoyBdLdBq1YvjqUPrAWKt+SdEN2jnU38CSSbLchibuJJLkJYAtSjZ+H3C+aWApcATwGXI0cR89DktoBYDESXCAJ/rvI/eRcZGsACd4OJG+oVduGGm5AtvaPkO3gEJK8XwOcj5yWFmfxD2Vfb9EHMpOlhsy4H0RKKtm4HhnPd9wUJsh/qthpyIxEXtonHoaOBZ4DvkeW/UNqwJVZPBNVz2HgEhcd6QLcHo9+ooBDuNk+FXgFSY4PIqejo0h+mSB39S+2rw6FrVgJvGMgafCPQZL2yHeUFdrhZVErjjEscD8y/rVRKx6FXEBujVpxjCGPKqRG12wSovh7ST9SqzkJyQ+OR6AzxvDAJOT/dQ1kcuUYMWLEiBEjBvwLrJi5AQmhVlQAAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle 2 \\left(6 x^{2} + 3 x + 1\\right)$"
      ],
      "text/plain": [
       "  ⎛   2          ⎞\n",
       "2⋅⎝6⋅x  + 3⋅x + 1⎠"
      ]
     },
     "execution_count": 123,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expr.diff(x, x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 124,
   "metadata": {},
   "outputs": [],
   "source": [
    "expr = (x + 1)**3 * y ** 2 * (z - 1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 125,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAGMAAAAaCAYAAACjFuKcAAAABHNCSVQICAgIfAhkiAAABDFJREFUaIHt2VuIlVUUB/DflIqThiUZJRVBZtnNootJGnYjKKKQhOwhjhi9ZET5UEqQD2HmJbqIkT00hRBWZuVDNvWQlVgZZPeH0KworSGUoqTUpoe1D/OdM9+Z880Z5wzo+cPH+b5122vvtffaa+9DCy0coViArfgDXdiA84bU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vIT9dTU7fVsT1ClHsfZ2gTEm2PygNiGeUD1EfF3O+FksaDsUjf1djOHJ0xYuMeyGpuGG+KTfvSgvILREfyNvnDAfcY2EpuGOVNe2U/dEaKS7QNg+LR0KIdv4i9sSk4TZS3z4mLwK8UP5SVcaW4TDvc/lyaJFLb6c1q8C6xGvbgZZVXIS200EILLbTQQhPwP/LsOdV159MtAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle 6 y \\left(x + 1\\right)^{2}$"
      ],
      "text/plain": [
       "           2\n",
       "6⋅y⋅(x + 1) "
      ]
     },
     "execution_count": 125,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expr.diff(x, y, z)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 126,
   "metadata": {},
   "outputs": [],
   "source": [
    "expr = sympy.sin(x * y) * sympy.cos(x / 2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 127,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAWIAAAAXCAYAAAAxxEW8AAAABHNCSVQICAgIfAhkiAAAB69JREFUeJztnGmsXVMUx39VQympeWgMRzRVJIaoSgWJISk1REzBB0OoCCWGmCP6xUyEoobSEkJ5YmgMaYhXSkrbkDw8iaoO4WlLW6np0Xo+rLXd/c7b+5xzX/d+51zOP7nJO2uvvfa+//t/e1h73ws1atSoUaNGIDwDrACGlt0RCwcDPcCFZXekIMrgsFU4SpB+Tg8ct2q6DfV5JITnq9ZnxTEa+Bu4OmDMnYD1wIP6vB1wEfAKsBD4HfgZmIN8SBt54rwCdAFbBuxbDMTgsChagaOE8ANLaM6rpNmEsHxVXZ+huG9pzALWAJsHjHkxIqSj9PkSff4eeA64A3hK2+0B2oBBjjhjtPymgH2LgRgcFkUrcLQJMArYJWDM0JxXSbOh+aq6PkNx37IYicyUjweO+xbwIzBYn48GTqLvTLYzsBQh9zRPrE5giRWraojFYTOoOkehEYPz/6pmW0Gfwbi/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KhRo0aNGm78Ax2nBerdfsuyAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle y \\cos{\\left(\\frac{x}{2} \\right)} \\cos{\\left(x y \\right)} - \\frac{\\sin{\\left(\\frac{x}{2} \\right)} \\sin{\\left(x y \\right)}}{2}$"
      ],
      "text/plain": [
       "                       ⎛x⎞         \n",
       "                    sin⎜─⎟⋅sin(x⋅y)\n",
       "     ⎛x⎞               ⎝2⎠         \n",
       "y⋅cos⎜─⎟⋅cos(x⋅y) - ───────────────\n",
       "     ⎝2⎠                   2       "
      ]
     },
     "execution_count": 127,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expr.diff(x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 128,
   "metadata": {},
   "outputs": [],
   "source": [
    "expr = sympy.special.polynomials.hermite(x, 0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 129,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAT4AAAAlCAYAAADbXoXcAAAABHNCSVQICAgIfAhkiAAAC0BJREFUeJztnX+wVkUZxz/3WopAZagIVGCYoCBw74SCBnbRUBhJhpKwxvTmYNOYORMR/ipEc0bzxwgEZmJ2sPIHUYbWNCSFTUlgMplWhGmZZWgoFXIRCKQ/vnvm3Xfvec973nPO++Pedz8zd+599+zuee7us8/ZfXbP84LH4/F4YnkcmGj+vguYXyb/xcAPgIMpfzweT3r8eM2JacDDwOXAtxLkfwx4azUFSsBXgZ/UWYZG4J3AK8Bx9Rakh7MamFdvIRJSy/EaAD9KWbYcaXQ3cT9dBfwG2AlsBx4BTorItxk10KFl6hsPLE0qZRVZC9xYbyEagFuAlU7apcBfgT2oXydXUN/pSEf+iZ7258XkvRu43fydVM9qRaWyjQV2AO+olYAlaLTxGlA9w+fqbq79tBb4lKlgDPAQ8DIwwMpzMhooDycQdinwfiftj5SeJi9MUGcaXgbmVKnunkJf4D8UG7Y5wP+AS4AT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3O/BfE+DJiTThsHtjOPYeGeK7l1OpbvZGvYQY3azGtnSz8Dw6JLoNfTNUEoYC96OnUKORVrY29OUwr+UukSctlepmb9RL8Lrp8Xg8Ho/H4/F4PJ7m4f+V7KVkWGl48wAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle \\frac{2^{x} \\sqrt{\\pi} \\operatorname{polygamma}{\\left(0,\\frac{1}{2} - \\frac{x}{2} \\right)}}{2 \\Gamma\\left(\\frac{1}{2} - \\frac{x}{2}\\right)} + \\frac{2^{x} \\sqrt{\\pi} \\log{\\left(2 \\right)}}{\\Gamma\\left(\\frac{1}{2} - \\frac{x}{2}\\right)}$"
      ],
      "text/plain": [
       " x             ⎛   1   x⎞               \n",
       "2 ⋅√π⋅polygamma⎜0, ─ - ─⎟    x          \n",
       "               ⎝   2   2⎠   2 ⋅√π⋅log(2)\n",
       "───────────────────────── + ────────────\n",
       "           ⎛1   x⎞             ⎛1   x⎞  \n",
       "        2⋅Γ⎜─ - ─⎟            Γ⎜─ - ─⎟  \n",
       "           ⎝2   2⎠             ⎝2   2⎠  "
      ]
     },
     "execution_count": 129,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expr.diff(x).doit()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 130,
   "metadata": {},
   "outputs": [],
   "source": [
    "d = sympy.Derivative(sympy.exp(sympy.cos(x)), x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 131,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAE0AAAAhCAYAAACcPyaRAAAABHNCSVQICAgIfAhkiAAAA7BJREFUaIHt2GuIVVUUwPHfzChlJpHY+zFBmRjTSA8nAyPooUVEYEhE7xLpYV9KKiooeg3RFweCmqSgCIKIsg8RpkRCSUSBVhSlBb2obOidqWXTh7VvnI733HvuvfOQmfuHw7lnrb3XXvvctdc+e9FmTFiBj8fbiSY5EN/j2Ab6vIBbWh14N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j7/Aox+CIRMwnqEAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle \\frac{d}{d x} e^{\\cos{\\left(x \\right)}}$"
      ],
      "text/plain": [
       "d ⎛ cos(x)⎞\n",
       "──⎝ℯ      ⎠\n",
       "dx         "
      ]
     },
     "execution_count": 131,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "d"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 132,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAIIAAAAaCAYAAAB7NoTTAAAABHNCSVQICAgIfAhkiAAABZNJREFUaIHt2WmsVdUVwPHfewjliYbaVK1Gy00EA8ZCHLCa0A/WeYg2ED6YVKtojHOMoqlTNLEVO1AlaWKtmighTsEpTWqlGmsDBhXUOBFFDU6AgkrqACh6+2Ht4zvvvHPefcMBIdx/8nLvWWvvtffZd+211t6PNm22E3bBh9hnAH3m45LNM5023xd/wl0D7DMRn2B0/dNp832wI9bhF4PouxTn1zudNlV04FIsx0a8j1k5/Q9wswjtG7AYUwo2puIlrBe7+CnsnnTTk6wj1356GmtMTjYnzWHXnOxaLBrca2mgiTsH2b+MufgIo4Zg4yAxrzNrmVGNzBI7dgbG4jCcl9PPwSqcgAm4DZ9jj6T/Cb4SztTA/jhLtyPMwb8LY3ZgSbIFM5XXEMcm212DeK+Geh3hYHyrnrrlIbGmO9VgqxZ2Erv8nAr9KPFDnJaTDcNb+F16PlAs+BjlPKK8PjgaX+O3+J9Y6CITk+2BFJkZwzFet8MOlQViwwzGKYscIt7ryhps1UI2oXEV+qofYh4eTN+H4XF8Jjz9XOyWa/sYbq2w/zQ2iZ1fxrg0/v6Vb7Bl2FdEg7/XaHMZ3hHrBzprNJ5nGh7FWrGrlwsPHJZrk+XtZoWNvvSZ7BscJXb4iyL3vYFJSb9WHB+L/DK16RR5t4wfpc81BflJeEKE141YKeqSfEprKE8NeXkD96Y5bhDp6sSSecwQa3Ffx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h2YbS4RDdaRPCqk0ubrZgrxA97QA22LtR3tGizFTNSHH3/MUQ7XeLIP7+o2NaLt+2FTXhe3LQuEWl3MIwTN7B/VH2X0aZNmzZt2rRp8x3/B/bJf3TK4bxIAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle - e^{\\cos{\\left(x \\right)}} \\sin{\\left(x \\right)}$"
      ],
      "text/plain": [
       "  cos(x)       \n",
       "-ℯ      ⋅sin(x)"
      ]
     },
     "execution_count": 132,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "d.doit()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Integrals"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 133,
   "metadata": {},
   "outputs": [],
   "source": [
    "a, b = sympy.symbols(\"a, b\")\n",
    "x, y = sympy.symbols('x, y')\n",
    "f = sympy.Function('f')(x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 134,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAFAAAAAgCAYAAACFM/9sAAAABHNCSVQICAgIfAhkiAAAA/JJREFUaIHtmUdoFVEUhr8YDYl9oYK9Es1CY0MwWECDoqBY4kLBRhYubCCiKIpBFMWycaGgIMGCvaAoEkHQKNgwEsGyUOzRqFgxYmJZnDPMyzh35sW58eXJ++ExM+c/58w/996599x5kMI/QxqQnmgRyYhMYAPwHvgCbCLVkHXCXuCX57cyoYqSCO2An0ijLQSm6fmzRIpqSGgcwvdH5j6A/cBH4CzwBmgKfK0/af8HZiAjrirRQhoqGoXwLfT4qb6FJCvCGrC5Hr/Ema8lsA14DHxHRu9y5fYAlUCzukmshUGaszBCjlh00XzHLeX7A0V6g9tx+p9W/zPAOo3PAQYji9ESC5pOABW4nRsFkxC9qyzk8sUWvcHlOHz7qO85H64E+ABkWdA0BHul1FrNNe5vE8Q7B36OI9coPR7z2LOBfOAwdhaj68B9YB7RC/pBerwVMY8R+5EeOhLgM5U/C23n1wfYqOejDfElyk/x2NOAYuU2erg1ah8bxzM0BhYD5UgHPgGWaf4K4LkFPUac0oDdAT55yFxXCVTreRHykOnATaAG8+KRC/wA7lJ7RG3Ve+/0iclXbkuI/gzcBikDNuuzVAG71H7Kgh4jLmjQthC/dKSoLvfYmyGNdyckvljvM0evV+r1IfynmVbKXw/J6zTSatwNAcAI3LekyIIeI25o4PoQv77qV+yxZ6u9JCS+EzIqHgMLcBejjICYKuBVAO8sNhcN/F3lJ1jS44t7GrwixG+2+i3y2Ifi9lwYNuCOiivIVjEIL5DRbYLzEWSkgS9VvmMUPbZW4YF6LPPYnVU3MyQeZH/toJDwfXYWwav6GOAdcMnA9wBeIx1hQ48vPlB7LjChFCmUW3jsHYivjpyu8RXqvyPEv5H6PzTwmZrHVJ7kKX/Wkh4jajTB1ACfNGSv/MDAVVK7N70Yj2z77gBtkWmjGimBTMhRXd6a00ET1e4tURyc1/h1lvT4Igt3Dgiqt3qrz0EDf1T5Xj7cMOTVeAS0V1uB+p8MuOdc9VkQ4OPM395FYjnuc022pMcX7WJulBfgN119loXw8z32XGSKqAB6ejhn9R9uyHkAGWGdA3TN0hzfkQ8Zm5Cypwp4qlxXS3p80QO3AfsF+G1Wn3wDn4GUG9dibL3U9t6Q2ymUr/pwrZBGiGdELEZGUzWyYBxDFrwnwFtLeozIxW3A7nUJ9MEKzTMgYh6QvxbqPBoSgWG4DdgmYq5MpNdPR8yTBbxE5tUGgdg6cAiyrG/Xa2d+qUGGdhR8A2Yi++IoH1S7IXvRpRH11AucOe8r8qqd0esbiRSVbHC+KMf+ChKqKMnQGtiH/H15G5iYWDkppJBCCvWK397dPTPDeJGZAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle \\int f{\\left(x \\right)}\\, dx$"
      ],
      "text/plain": [
       "⌠        \n",
       "⎮ f(x) dx\n",
       "⌡        "
      ]
     },
     "execution_count": 134,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.integrate(f)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 135,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAFsAAAAsCAYAAAAKEcTgAAAABHNCSVQICAgIfAhkiAAABSdJREFUaIHtmmtsFFUUx39LsWlFxPggiuIDCZYYKQ+DWFGMNhg1Gnn4ARMRwwdNpJIYA5aoVIVgAL+g0QQT0viIilQIpGpKNFEwUTCgNAH9IKGKVusLtFIs1fXDOeNMZ/fOzM6j293OL5nM7rn3/OfsnTv3nntnIaWkWQ3sLHYQg5FhCWhOBr5MQLfkSaqxv0hAt+SJu7HPA8YA/wIfACeQXj4j5uukALOBLLAPmAXUAO8BHcDwIsZVliwD/gYucdgmITdgfFEiGkQUMoxkgAqfOlOALUhPtvgrxLXKkiANUAWsAX4DjgNrMTf6ZGC/yzZV/Q6HjHFI8SoyDDiPFXnqnQ70AY0OWwbYDTyfcIxlwWgks8gCDcDd+vm7PHVnAKeAg8A1yBj9GnAEOHsAYi15rOwiizRYBdAKNCM92cmDwFfAXOBbJO1rAc4foFhLnnuQhu4pdiDlgN8EOVLPfyQdyFDAr7HP0HN3Qtc/E9iAjOu9yFO0XMteAbqAESG1p6ne4mgh9uNi1XwnRs3/aVLxpPY6dqh+K7BKrzcRuBqZmB+JqL8V6MTuNFG5C4n38Zj0+rFexXcnoF2j2u/nKWsDjgHVEa8xHXOqGoanVe/WMM5Bx+w/w4j7cJOeW1z2CUA9sJnoE/MeJEN6AP/VbxCm6XlfDFo5vI7cybdj1JxH7iLJOmqAZ/XzzQb/Ni2f67JnkJQ0qxoWK9V2S8D4hgNLgQPIze5A9nwyyJB0NEIsnmxXh01BHQJQh4zNXcgiqEmPlUjv+xxZiZomxlrgH2Tx5Oytz2msG13169W+PkBsldgNuB9Yh/z2HuBltW+PEIsnH6rThkKcAlCBLHoOuOwjkIZu9/Fv1rgW6fcV+v0tcofGUVq2J0BcVoM+gfROixuwn76mCLF4slcdVxfiFICrVLfZZZ+g9jYf/4uQ3nYEWII90VYa6vcAP/poWpPpR4byg1p+R8RYjBxS50a/igVyn+o+7LJfi90r/FiD3ds+IXf7wMn3yBPjhbXhNstQvkvLLwwbS7Gykal6dm/HWtlHVQCNnx2fFyPDkolq/DOb2cCvwMeG8nHAT8iNixKLkWP0H4/iYheyaBnpso8hWF6/QP07tf5LHnWHad1vPOpUYb/Oy0edlr8bMRZP+lRgXliBPGSQvZavDWVd9O8pbm5DlvbtyAvmQ0hWU2OoPxH5De583slpyG89aijfqRqrIsZipBp7HAqaowbhCtV801C+BfM7y5nII3oYuEBt87X+NoPe/Vq+xCcua35yT4DLsdthTsRYjIx2XKSuUGcPFqjmMp/yh1z2WmRY6wQud5VZWdP1efTeQHrtWJ+4FqpGL7IJthZJF3uQ/fks9ovssLEYGYfd2JMKcfRhnWrWG8orkTTtM4dtvNp+N8RiLVw+ddlHIY0VtKctRXrqKWQybEEm8w7gl4ixeFKL3diXFeIYA4163SkRdRoI0cuKwUzsxj53gK9dhfSmHRE0qoEfkDlgUODMs6cjqc2L+t0a4/qQR2YgOQnci+yThH15cCmyN/FoTDHFijVGn0Ae31b9vjeA75PIPkc3krZtItjCZEhjvTlxHvN9fDLAU8B1yGxdj6yyHksuzPLgLOS/HseRV2F3htTZSO4mU0oMjEW2YNuRv6h1I6nTM8UMqhw5B8k5NyOrzCuR5XE3/sNPSoEsRFZSzo32RchY715ZpUTkdiQ1nIOsrBqQJaz7BqQQvUEywAtITnwS2VzqRf73cWNE7ZSUlJSUlKLxH6iTdiJAjTKBAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle \\int\\limits_{a}^{b} f{\\left(x \\right)}\\, dx$"
      ],
      "text/plain": [
       "b        \n",
       "⌠        \n",
       "⎮ f(x) dx\n",
       "⌡        \n",
       "a        "
      ]
     },
     "execution_count": 135,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.integrate(f, (x, a, b))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 136,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAE8AAAAVCAYAAAAHIbMXAAAABHNCSVQICAgIfAhkiAAAA3FJREFUWIXt2F2IVVUUB/DfOGVOFqOQUWG9NA1loEQhGPXmQ/kQUSL1VokSZVFCgfaclWU9RBhlIBGUNZHgSwxE2geUHxXYx5OTBjO3nDIjaprUbg9rHzxz7zlzr3MPlMP84XLPXuu//2ftc9dea5/LDGZQgtdxFHM70LgedayuJKKzBDfgH6yvQOs91HBBBVpnBQZxHD0VaC0V2bexAq3/PfpF1r1SoeZ3OILuzDCrQvEMS7EDwxgX6T6IVQXcVfgIv2EMB7EB5xVwb8MHSW8cI9iDBwq496ErxVGEQZFJdzTYu7A9+Z5u8L2FK7C8RLNjrMFJsbh3sAnb8BV2N3A3pSBHsRXP4utk241zc9y1yV4T2ZTp7sW+gjj2pzjKGsUSnMK3cpmELek+RRm7PPmeK9HsCItwAsdwbYF/Ye56WQrkB1ySs5+DXZrrywHxg1xcoHtRw3iueHAHW8S7Pd3nnjTemMY7FO/I3uTf20J3SngxiT/aBvfVxF1b4OsXWTGUsx3AH5jfhnZ/0h5swVsoSsVhrEtz3sfsSeaM4ccy5+Ek0u7njdzcfcl2dYugiYdRR1+J/0jyz0vj9Wk8ghdwOxaUzM2yuqze5fGU02v5FOe34A+LrEZskzwO4a82bpphJHedLXS4jXm96btW4q+J4twrjhvP42fRHB7GI2LBe/CYqHEZxtL3nDbiGM1dr8afLfg9Of1KMZXMu7LE35h5eczDCrH1T+EXE2vhZWnuJy1iuFscZ2qJv7UFf1biH2rBmxLOpOZtU/7K06e55pXhtaRzZ87WJV7JRgtnBFbgb9FUFogz3AmT//DXpHu920ZcZ4x8t11U4M932xtTIN+bWLu6sTP5nsjZb9FcYjjdmW9tsA8or6k3ie05hEuTbWXi7yzgZ7g3cdZNwukIa0TWjONtPImXRU36sIH7TArmJ7yEzSIT6vjYxK53XHS5AXHO2iKODPWknT8TEluyjgcb7EuSVk1zycjKzs0la3tTNIvLS/yVYJlI7aNia4yII8DKAu5dojb9LhrVNyLjGov9/eLlfEhkzTF8icdxYYHubPGwP8/Z+pLtVywumJMdgj8r8PWKRjFZZk4rbBAP47oKtB4yeVZOO8wRXXtXhzo9YvcMNDq6m7nTBifxhfiTYb9oZlPBVaKGbxb1cgYz+I/xLwMn9bMIjS9oAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle - \\cos{\\left(x \\right)}$"
      ],
      "text/plain": [
       "-cos(x)"
      ]
     },
     "execution_count": 136,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.integrate(sympy.sin(x))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 137,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAJUAAAAVCAYAAABPEqyXAAAABHNCSVQICAgIfAhkiAAABO1JREFUaIHt2VuoVVUUBuCvsotoqJSV3SQq6WYmhWUQ9NBD9RBBEdVDYKWFXehChUUvQUV2gyIKy5cuWGklSJBGdKWbHkssKkPTLlpqZkmZqdnDmBvXOc2199rnrBPtOj9s1jlrzPGvsf495xhjzs0ABvA/wpNYiyF94DgRO3BZLRH9N9BM16lCr0sr8HSctifhT9xQA9dLWIOhNXB1Olrp+oSYKOMq8nWUtguwEYNr4JoghLq1Bq5ORytdP8JmDKrI1zHajhGraUaNnJ9hFXarkbPT0ErXPfEHPmiT92/a7poZNAHP4TtsEeltAS7oMe4CvIWfxexeimkpuBzOwWuJbwtW401Rx4u4FLukGMpwMZ7BMmzCT1iISSXjn8WhOKMJZ3+jqq60p21duo7F7ujCCXgBP+LXFOdxJX4ttZ2MbSm42bhL1NmP8UZh3F0i7a3Do7gXn6R7b6TgipiSbGvESmnwfigmQxGLUgxlDfre2Ir3MBN3p+v69IxbMj5nJNt9JZz9jaq60p62dep6ReJ6WUykOZiOt9P9tRie8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oS1eaaPtv/dV+m6jxe4reYGsveY4Ufcx0O8/M/s+oS1cGtB3AAAbQ0fgLQlv2cN9BIm0AAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle \\cos{\\left(a \\right)} - \\cos{\\left(b \\right)}$"
      ],
      "text/plain": [
       "cos(a) - cos(b)"
      ]
     },
     "execution_count": 137,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.integrate(sympy.sin(x), (x, a, b))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 138,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAADIAAAAYCAYAAAC4CK7hAAAABHNCSVQICAgIfAhkiAAAAntJREFUWIXt1kuIjlEYB/DfuN9yLTPZUaRs5LJjigVKJqKEYkGuJeRSSiGxoBQLCzHkmmsWIjZyW1m4DSUJiUjG5H63OOfL1+t7v/c1Bqn517c4/3Oe//85533Ocz6a8X9jDD7gWxP+/gn2Y/6/Mm8qdEY9uv8h/Up8wZY47oFZOI67eIcGXMRMtGis0Swc/Z1MMzBbKLURcTw3jh9jHzZgJ15G/ggqGmN0ATW/mWw5nMJztIzjkRjn55OvwkNhMxN/1aQPnqF1yvxY+S/3wBLxXYQmUpszn5VRa2uBaJVY0FG4C08S/HQcwKcU4QZswzzUCZ+9gP6YLNT2WVwvET8WbXAsxyYU5fE5OdEvJvpGqMdiVOAeBmWITxBOaV2CXx75mWViD+M12mV4EA7/RtQcnZyswhCcFzbTqWiuGjdzGKyJ4pMS/MHID06Ja4dXwmbyYFPUO1luUaFzTC/idmBZDoMTMbZvgr8jlELblLiaGDc1h8fCuPa2jGegK97jTBy3F96OXjlMHggnW9wSO+GrUAppqBUuepcM/QXCJuqECsrEUeFh6oVpOJ0jpls0uZTgh0d+T0pcS6HlnsrQXxR1bqBnqQWlXse9kZ8ilNjuDBN+tNRrCb7QIK6mxFULL/jxMtorsDlqjBCegVxogxdCp6oXyisLi4UTm53gt0d+VErcVuHrV6bMr4rxV2TcieQ7Ah9xCHOEi/6unEBE2hcpmA/ALTxKzI/HZTwtoTkDa4WNXhAuehL3satcYsOEk6gut6gIV6NhhwQ/WbgDb7E0MTc0eixJ0Vwt+1/CuazEKrBRI/+U5cT6mEzvP+jxV3BbehNoRjOa0cT4DrTZsQaD0h4hAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle \\frac{\\sqrt{\\pi}}{2}$"
      ],
      "text/plain": [
       "√π\n",
       "──\n",
       "2 "
      ]
     },
     "execution_count": 138,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.integrate(sympy.exp(-x**2), (x, 0, oo))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 139,
   "metadata": {},
   "outputs": [],
   "source": [
    "a, b, c = sympy.symbols(\"a, b, c\", positive=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 140,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAADcAAAAWCAYAAABkKwTVAAAABHNCSVQICAgIfAhkiAAAAqlJREFUWIXt1k2Il1UUBvDfFJofY6jlR6IIga5C0gpbNCIIIghREIoKQggubBFCtgtUrEVt3CXVEGofhrpwIVRi+RmVaIoKNoRQBJaKLsovZLLFOX995533Zd7BhhGaB97F/7n3Oee595577p8h/D+wCLdw5z/8Hhh8hjWDbWIg8CiuYvxgG2mKh/oxdwm+wZUB8jKoOIwXB9vEQOBJXMSwmvHFmjeQpyv0y/EpuvCXKP9jeLUPX/PxBX4Xje4CvsJL8HBp8mg8jr9L/Ov4BXtrkkzK4M/hLN7Hwfz+xFM4gk7s1LNLjsH3uIHj+Ba/4Xksw00crci5OfNMygXtE5vSgcv5G8zE57gmdrCINpzHnJqFtfBymt5U4t9MflWNrh2TK/gnxCmeqxh7J2PuEgdSjje9SEzGszgkFtheGJuHMzXGitiQCV8p8TuSf6ZBjDJ+FtehiNnoFmU7vD/BVqeRlQWuE+saaPekdkaJ78JtPFKjG4e3RGleFcaLd/REaf725Bc08NQDY0WNf52/R2bCKQ20v4oyaitw7fgHp2s0s/BHmv1B3KG3sR5bk/+4pLkonqP+PGN3sVvs3hSswJcNNOPSSPnidyS/vUZ3Smzm/Iqxjal9rcCNSO6nBp4qV/9J8stEeW5tEKfV3k+V+FYTOlmhmSZO7kB+RYx17xk4XuBbVTGxgadKDBfHfl6U5MgGmrViR1eX+A+TX1ihmZBjXXq+n4+J1n5H3NURJd3pHFtSEXOm3s9bL2zJAB/1NTHRuh9zS/zu5NdiaoVuv3tN411RvpfFW9itdyUQfxi6xV3em7oP8KN4xPvEC5l0XpPJouy6MarEL02z1/FGhW4CtuGSaEbfiaswO/N31uTrEAu7Ik73gmiCK5qYbcN7ena+IQxhCPePfwHgVb/OkY0I2gAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle \\sqrt{\\pi} a c$"
      ],
      "text/plain": [
       "√π⋅a⋅c"
      ]
     },
     "execution_count": 140,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.integrate(a * sympy.exp(-((x-b)/c)**2), (x, -oo, oo))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 141,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAKIAAAAgCAYAAACRiqPIAAAABHNCSVQICAgIfAhkiAAABiBJREFUeJztm3uIVUUYwH8+283CDdJeVicTMYPsIYJiRRBZUmFlkkFPUaI0ScLQiiRKy7KgKHuYZA/S0golC6PUNDAfJVn6V+ZWetMt3dJcH2u3P77vcGbPnTnn3rtzvZt7frDce+eb+c73zfnOzDczZyEj439GB6BTtY3IaL/UADOAPcA+YCZZQGZUgbeBfOxvalUtymh39AT+RYJvAnCzfv+1mkZlHHt0TpFfiOSGAO8CfwFLgQbgeGB/5UzLyIi4FRkBm6ptSMaxTccU+Yn6+XelDclo36QF4gn6uc/T9QJkhH3Tkz6At4BdQDePOquND58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0DsgKywGwpqRwwHDiHJfw8kzTiMPdhKyRHn4D4a60Nhjugi3j++fQo5T6+zqEx5FyQOfnPIP9f2T3iw1Uot0dw+LKHe1dhfJwtXkOZOe4CfQARYiDtXG4pMAVuJTnFG4s5FzVVzf4vcXDWHI8DPtMz1OqnuPPCwUV5K//j0KeQurTO+TDlEa4X4YuQhohi5wYOtVnoaFxmSUK8RWXEtRPaiZiFbAXlkX8zcUwvwF4ijtfy+WPkAtSlH4fQZTsGXWvSNRUazg8D7yE7BK+rD8ljdp1XPTuAl5N8nNmnZKlquCkvpH98+AbyHjGhnlikHuF2vcQh5IWOm+tCE5L554GwPtlrpTRSIFyTUuwdJwLciT8FuZMNzMtFiJyTAXyB2RW7wN0ZZHy3b47A53Lxd47jWYGSK2oV0+g5ku2Gkpe4tSD63F9l4/xEZCeOLjVL6x7dP3ZFgcY1CaXKTierDYeQBXIScppjba63tfysDiALxnFIaHkWmIPZdVG1DPOLTpwkkj0Bp8jbBUKJAjJ+QtBVqkCdySbUN8Ygvn2qREX1hmfKjirk/NwhZgr+sv8OcoRkZatsiB4DbkFzrWHkx1pdPAXKe+2CZ8qoR5oT7kWkhfK0nfjCfkVFxwi0F88+WqGdkVJQ64B3kHbuNyHt0GRkZGRkZGRkZ7Yv/AM4NY3vfgi08AAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle \\int \\sin{\\left(x \\cos{\\left(x \\right)} \\right)}\\, dx$"
      ],
      "text/plain": [
       "⌠                 \n",
       "⎮ sin(x⋅cos(x)) dx\n",
       "⌡                 "
      ]
     },
     "execution_count": 141,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.integrate(sympy.sin(x * sympy.cos(x)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 142,
   "metadata": {},
   "outputs": [],
   "source": [
    "expr = sympy.sin(x*sympy.exp(y))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 143,
   "metadata": {},
   "outputs": [
    {
     "data": {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L0W55wIfveZbdjBU5vp/ZPlAZP3m24AnQ1MCTw72fTv58ihkUFuJoTY5MttPnx56AFORrDLC6MssdZiOzbUowHYg1qwbNhJdpL9aDfbK0P0B0xf49DVAHej7agf+I302uNSe/bTLPFno9/VZbarHTZD4bae6HyBXqQB1M4WFdUo+VzLVRzIp8ZYS/iRcC2ZNUYYXjc/DT5ZBZrprm0G9FL1oeL0AjSIp8l8oePg9iqL8U4pnH+Duy/3MJ0YDlBI70pcVbq/K/EOgH5Gg+OhEhV6KWCJT34nmXUZDHYwdwXkzSavDcino3qhE7jEZDPN1lVglprbueZ/QQE+QjEDDUgK+AgVaSuBt9ESdbAUQUMwD832Xov/DPAKOlfYGrB9DuX8K/Ayqps6TPYJ6R3CCVS5N6OefwVq8VLmO3h4NNt0j/lkk8xPF5lbmLcN3hqQl5rb9ahzuaxAP6G4EZF2BP2QY4jkNbhP/0qJaWhp7EZL9mHUCs502N6PaoGTwN9o2V6C9nc/HkF/OnWiGd8DfAU8ibvYHYG4+MLua+3+OHCtw947aGpz6ErF7RjUqoa1wglKhMVosK8rdyIhWIh7lUpQYoxC3c2mcifiQDVaSZuDijiKwf87zgBfoj+0dqFt4N+C8agOW47qngQJEiRIkKBY+AdYT5UEv0XGdQAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle - e^{- y} \\cos{\\left(x e^{y} \\right)}$"
      ],
      "text/plain": [
       "  -y    ⎛   y⎞\n",
       "-ℯ  ⋅cos⎝x⋅ℯ ⎠"
      ]
     },
     "execution_count": 143,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.integrate(expr, x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 144,
   "metadata": {},
   "outputs": [],
   "source": [
    "expr = (x + y)**2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 145,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAKAAAAAaCAYAAAAwnlc+AAAAB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vamyykXtYXaLs1+nBsgbaJcq+mRscBpkWbm+PvjcIHwHklbCbKv4LzaG2Ghv+ZL6xUHwub/23C2e7MEjbnCaIWF2g7GNtOK9A2UXxgmhGHCp/iV/uyAkXznBUS5SZgEa2N1gAuFJbdr3BCLLsmdvBiCburhCck7YNipvBVVMsk+xLR/Sn3s5AoNjDNikOFx6KtvcJrr+zBfKL4BCyqtdEadOFHYQk+veZe5Visu6Dt7UJaJY1bhadtk5Bv6hGO5L6Mfe6QI39UQyL/wDQzDhWus2+zf2NJWxSfgGW0NlTDDCEFskd6EvSS2NGWArbnxLa317k/C48Im+VdQhLzJyEAS5V7shL5BqaZcaimO9p5VzhtKEsi/wQsq7XRGppG5ZP9tFY70ka8JGxJ5rTakRKMGw3b5EsFTHQqm/aHW+1ICSaChgOKU3AnnhBOjD5RPqE91kwEDQcslf8DuQfPGX6ENV6YCBo6dOjQoUOHDh06tAn/AfdWuQOSJzl/AAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle \\frac{x^{3}}{3} + x^{2} y + x y^{2}$"
      ],
      "text/plain": [
       " 3              \n",
       "x     2        2\n",
       "── + x ⋅y + x⋅y \n",
       "3               "
      ]
     },
     "execution_count": 145,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.integrate(expr, x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 146,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAN0AAAAaCAYAAAAzKVkWAAAABHNCSVQICAgIfAhkiAAABZpJREFUeJztm22MHVMYx3/tljRUqKIIQhQbaS2i6RebaElEBamXD+0HjrQpSUVKiZcQ90vtNmzQpeIl3AofqkJDZNtqRbE0iMXSDUGWhrXadFW9BGV9eM5k505n7j3nzNw79+49v2SyOzPPec7Z//xnzplzZsHj8TQUy4DPgF/19j5waa4tagzuAj5ENNsFvAbMrOO8452G8vEVwHzgNOB0YCXwD3BWno1qADYB1yM3xC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0/hbkxficmNgWZDq2x6GePqTNR1mWU6QfXuatmymm+i5H/o5+4JgU9QUo0mlso2+eusVR1pfzkTu5H3nxG0C+QWt1amYpXwC/Mzb7k7RuMVefX+pQx7AuO9WynCKdIepBN1NM9L1Dx/Rh/wBLQuGusYu+eeiWRKIvz0e662+B4/Sxq3XwBqdmlvKEzrUPGSYkvR90I0+luJfPVmQ2LspExhYhe2POV0Lhboh60c2UcvoC3Kvr+yiDusIo3DR21beWujn5sg351GcIODVyLviUpd29vQBcy9hL8JIycTuRqdY4liNPuK3I2kzwmdI3Ou8Qlden4lC4GaKedDOlnL7X6Xr2I1PehZhNOdarsNc4jb611M3alzOQac4R4hcML9IFt6dsdLvO8wHJ3+/N1jG3JpyfCTyGvHjvRsyxF7kABdyfZgp7Q9STbqZU0rdA5ZnGtxzrVthpnFbfWupWLV+m5lWke55dJiaY6j2lJi1qDEx0M6WZ9G163YKX2UcrxA1gN0U/3jHVzZRm0bdpdTsJuBN4Clnp/5z0i8XNgNfNDa8bY/9zNAK8SOknOZ5kvG5ueN08Ho/H4/F4PB6Px1N1/geQ+Z3anxdSJQAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle \\frac{x^{3} y}{3} + \\frac{x^{2} y^{2}}{2} + \\frac{x y^{3}}{3}$"
      ],
      "text/plain": [
       " 3      2  2      3\n",
       "x ⋅y   x ⋅y    x⋅y \n",
       "──── + ───── + ────\n",
       " 3       2      3  "
      ]
     },
     "execution_count": 146,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.integrate(expr, x, y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 147,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAACEAAAAUCAYAAAADU1RxAAAABHNCSVQICAgIfAhkiAAAAc5JREFUSInt1U2ITnEUBvBfM2Oat4g0zMpilpiShUJN+ciGjNWUlFixFDtlI6IkC2ZJNna+kskrSpikrGQjTbEYZYMhlGHGWPzPm9t1P16ykDx1+9d5znP+zz09t8tfht2YrXlmSrR9wZ0u4AZxGa8wFectbG41dGWaH+NwySWD2IBmCb8NHbiaqx/CEbzGaBjoxUqsw42SeYV4KG1iqIRvxkWdmdpwaG5jXoFmzq8YGIhhL3OXtDBfWvP5TK0Dz/EJi+ou6KprwN44zynOxBZ040qmthb9uITJ6BnAZzySNts2GjFkBktKei7iI3oytf3S9kbwxM8Bv6eNDbWwK0SjJXwPPoSRLI6Hbhrj2Ii5WI6bwd1t18SDEGwt4YeC35Grn/Djk16R4xqYCH5NnYFl0TihOJCkME5J4cziYGjHS3Rng99HSnEZ6gLZKW3oDt7nuGdxviuZPRlno+J+PXirOpDrpbfZU8D14muY6C7gm6HdXmViZzRdr+g5Eyb7SvgLMeNorr4J38LggioTY6oDScrKWAW/WMrELO7jpPQVTUtbGq4ysFR9IFdFz4GqQViIU3iBL3iDa1hdo2sLx8JE/58Y9rt4Kv11/+Pfw3d6IH1macrSsgAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle \\frac{7}{6}$"
      ],
      "text/plain": [
       "7/6"
      ]
     },
     "execution_count": 147,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.integrate(expr, (x, 0, 1), (y, 0, 1))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Series"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 148,
   "metadata": {},
   "outputs": [],
   "source": [
    "x = sympy.Symbol(\"x\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 149,
   "metadata": {},
   "outputs": [],
   "source": [
    "f = sympy.Function(\"f\")(x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 150,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle f{\\left(0 \\right)} + x \\left. \\frac{d}{d x} f{\\left(x \\right)} \\right|_{\\substack{ x=0 }} + \\frac{x^{2} \\left. \\frac{d^{2}}{d x^{2}} f{\\left(x \\right)} \\right|_{\\substack{ x=0 }}}{2} + \\frac{x^{3} \\left. \\frac{d^{3}}{d x^{3}} f{\\left(x \\right)} \\right|_{\\substack{ x=0 }}}{6} + \\frac{x^{4} \\left. \\frac{d^{4}}{d x^{4}} f{\\left(x \\right)} \\right|_{\\substack{ x=0 }}}{24} + \\frac{x^{5} \\left. \\frac{d^{5}}{d x^{5}} f{\\left(x \\right)} \\right|_{\\substack{ x=0 }}}{120} + O\\left(x^{6}\\right)$"
      ],
      "text/plain": [
       "                             ⎛  2      ⎞│         ⎛  3      ⎞│         ⎛  4   \n",
       "                           2 ⎜ d       ⎟│       3 ⎜ d       ⎟│       4 ⎜ d    \n",
       "                          x ⋅⎜───(f(x))⎟│      x ⋅⎜───(f(x))⎟│      x ⋅⎜───(f(\n",
       "                             ⎜  2      ⎟│         ⎜  3      ⎟│         ⎜  4   \n",
       "         ⎛d       ⎞│         ⎝dx       ⎠│x=0      ⎝dx       ⎠│x=0      ⎝dx    \n",
       "f(0) + x⋅⎜──(f(x))⎟│    + ────────────────── + ────────────────── + ──────────\n",
       "         ⎝dx      ⎠│x=0           2                    6                    24\n",
       "\n",
       "   ⎞│         ⎛  5      ⎞│           \n",
       "   ⎟│       5 ⎜ d       ⎟│           \n",
       "x))⎟│      x ⋅⎜───(f(x))⎟│           \n",
       "   ⎟│         ⎜  5      ⎟│           \n",
       "   ⎠│x=0      ⎝dx       ⎠│x=0    ⎛ 6⎞\n",
       "──────── + ────────────────── + O⎝x ⎠\n",
       "                  120                "
      ]
     },
     "execution_count": 150,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.series(f, x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 151,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "x0 = sympy.Symbol(\"{x_0}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 152,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle f{\\left({x_0} \\right)} + \\left(x - {x_0}\\right) \\left. \\frac{d}{d \\xi_{1}} f{\\left(\\xi_{1} \\right)} \\right|_{\\substack{ \\xi_{1}={x_0} }} + O\\left(\\left(x - {x_0}\\right)^{2}; x\\rightarrow {x_0}\\right)$"
      ],
      "text/plain": [
       "                       ⎛ d        ⎞│            ⎛           2           ⎞\n",
       "f({x_0}) + (x - {x_0})⋅⎜───(f(ξ₁))⎟│         + O⎝(x - {x_0}) ; x → {x_0}⎠\n",
       "                       ⎝dξ₁       ⎠│ξ₁={x_0}                             "
      ]
     },
     "execution_count": 152,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "f.series(x, x0, n=2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 153,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left(x - {x_0}\\right) \\left. \\frac{d}{d \\xi_{1}} f{\\left(\\xi_{1} \\right)} \\right|_{\\substack{ \\xi_{1}={x_0} }} + f{\\left({x_0} \\right)}$"
      ],
      "text/plain": [
       "            ⎛ d        ⎞│                   \n",
       "(x - {x_0})⋅⎜───(f(ξ₁))⎟│         + f({x_0})\n",
       "            ⎝dξ₁       ⎠│ξ₁={x_0}           "
      ]
     },
     "execution_count": 153,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "f.series(x, x0, n=2).removeO()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 154,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAO0AAAAYCAYAAAAWEnolAAAABHNCSVQICAgIfAhkiAAABrlJREFUeJztm3uIVFUcxz+jYm5GSmVmVFTUliJZlJKVNmolZKX2INKkMVMCzexFaEhDkVopmpZBRK49BFEz6WFI0JLayy2tJbekjTFKM6WX1Vq7Nf3xPdPcvd7n3Bnv7HI/cJl7z/zOOb/5nfs7j985AwkJCQkxMxvYBvwG7AdeB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$\\displaystyle 1 - \\frac{x^{2}}{2} + \\frac{x^{4}}{24} + O\\left(x^{6}\\right)$"
      ],
      "text/plain": [
       "     2    4        \n",
       "    x    x     ⎛ 6⎞\n",
       "1 - ── + ── + O⎝x ⎠\n",
       "    2    24        "
      ]
     },
     "execution_count": 154,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.cos(x).series()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 155,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAPkAAAAYCAYAAAA4V1u3AAAABHNCSVQICAgIfAhkiAAAB/VJREFUeJztnHmMFVUWxn8NjgFRccUlOoOIxHXQuBuX56AxijtjIhrjU4jjBHdj3EcSlyYOjigalRht95kA6mRGUdy3qAOJzDBDuwGNC6itgmsr3fr84zsvXdyuulWvXtV7rVNf8vK6zj3n3vNO3XPPvedcgAIFChT4GWES8B/gS/u8CoxtqkbNwWSg4nw+aqZCBerGFsA9QCfQBSwEDkoiuFaOSjUDHwCXAO8ALcCpwKPA7sj5/5/wFlAKPP/QJD0K1I8NgFeAl1HQ6gRGAJ80U6n+hM+BPzRbiQZjMvDfZitRgHuRIw6ps5/rkJP7sDvasU2oc6yfFQYC44HVwC4evs1QlLvZoR8AzAZWAN/b91zgiMw1zR6TgW+BD4GlwEPA8BiZMDv8HpgOvISOPxXg/gj5jYGJwCPAu2hL+QWKPhOAAZ6xtwLuApYjW3cA04ANY3RuBEYA1wJvoIBR1a8NGO2R2wP4EbggAx0WATcAD6JFYwFwFtqtBvEImqfrZjBmv8YuwNdAD7CSeKc8A03egwO0K4zWCdyNVtIZwDzg+oz1zQOHA+OQLQ4BnkEvfyOPTJgdFhjtK6Adv5Ofae3LgQeAVuS4q4w+i76TEmBb4GPjeRSYAjxrz2+ixaMZaAGuBL5DzvocWvCmAE8YrRs4PUJ+LvrtgzPQ5Tv7tAK7AaehOT7J4dsL2e2yDMbs11gbGIlW0lbgU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0dEspiF2BY1CSpsNpW5BUabK3RZgdssAk4CZ0bhyDaswuvrDvoRF9rO/wRSEre29i318RcJIItAAn298PB+hd9u07+lSRx7wGBaQuH8N4dI5dgVaYqIxso5CHPgNRuWiOQz+e3rJJGKpnyLjIEoYy9W/Xs7ZFlB3CUCJ5JD/PeBcCwzx8/S3x9muT+ZH4qHqy8S5izTN0dTfwcox8Xn42wPpdHMVwBFrVF6IEUzvaumyfkQK1Ii99qmepMxz6Jtb/KsLPRnNM7sQUY5apz8nzsEWUHcJQIpmTX2x8b9AbGaOwrfEuJbqE9i2NLaF9YHLHeHhGod1FN7Cf09aC8kGdrlAAefrZDkj/2WGN+yODLkH/4gV0rbGCbiI1GnnqMx2duzcLabvfxrjGoR+KVshV9N0aJkGZ9E6ely18dnBRIt7JrzSe+fhv1wXR3y7DXGhyi1FUdnEkcuAeejPjLmZZHyND2vL2s9Osr7PchtFo8q5Aq2sQ80zogAwUSIq89XmfvnXHKoahzHoFeBFlh2eil9qNyhdpUCbdpMvTFj47AByLklRt9FYXFgdowVrsqfRWJm5E9+fdTzlkDPdaayu911rfIv211jLp7D0AJdIqqOx4H8ryz0BZ9Ap6F747BeONzy1xNcLPHkLvYOsgcSRKt69EdT8X1eL6a3UOnhR567OnyfuueG6EIslStK36DPg7sE/KMSHdpMvTFknsMBl/lrqjBt4K0eXHrdFtuxXI3stQ0i7pbiAMZeo7Ho0DHkdRuxstRC+iuxTre+RAR72PgNcDtEb42VCUcGvGzrtfoVqWibvN9EtHYYd8US2vuffa88TZNH7X3S/RTm0lq18qCjvki0FoR/KPBo03GJWkZzVovAIFCgAHon8wUu9/GpEEO6Aj0/AGjFWgQIECBQoUKFCgQIFs8BPy7d3JoWJsJwAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle x - \\frac{x^{3}}{6} + \\frac{x^{5}}{120} + O\\left(x^{6}\\right)$"
      ],
      "text/plain": [
       "     3     5        \n",
       "    x     x     ⎛ 6⎞\n",
       "x - ── + ─── + O⎝x ⎠\n",
       "    6    120        "
      ]
     },
     "execution_count": 155,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.sin(x).series()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 156,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAa8AAAAYCAYAAABN03J4AAAABHNCSVQICAgIfAhkiAAAClFJREFUeJztnX+wFWUZxz8XiCBUqEyr0UI0UlOpES0btQPYOEqlSU6hOW2BVkOa5TSKZZ0p9TKKRqBWTJOYZjlg2VhRRHhTKwtKkoKggEuaaJigpFfhyumP77udZe/ZX+/ZPbuX3u/Mzjn77vvjOd999nneH8+7BxwcHBwcHBwcQpgNrASeBbYB9wLHlCpROZgFPIJ4eBb4LTC1VInKx5VAA7ipbEEGCeqIr+DxRJkCObSF1wG3IbvYB6wB3pW28JCChHJoogbcArwTmAz0A8uBV5UoUxl4DLgCOB6YCKwA7gGOK1OoEvEO4ELk0B3SYz0yev5xbLniOFhiDPBroAt1Yo8GLgX+VaZQDvHYD3gJeG/ZglQATwMfL1uIEjAa2Ig6Mz24kVda1IE/ly2EA99BTmZUG3Vci5xXEo5HI+wZ4QvhkdcHgAXAA2hqpwHc0YaADgOxP+L96YjrByPnNt+cvxqYCfwQ+DsaXj8DPIhu6GAcPQ8FpiNH/puYfGEufJwC3A1sBV40n8uAM3OXtBgsBJag0WcaFKETF9CcepuZVvAKYBzwT2Az8D1gbEL+MHdZbVw7XB8CfBt4HOlpLzAPeGWCzJ3AOOAa4GFki3z5FgETYspNBD4MzAGea6P9s4GHgDuRI1wNfAqNxIL4A5qhuRrZi0isRjdzJ7AO57yKwF1IYYZGXL8I8T7JnH/CnD8OfBfoRg/EDpO+hIE3vKo4FvgPmjrdTrKzCXMB8AWTtg24FfXgFqJ1xetylrcIXIgeyOHmvIfkkVfeOnGoybuTweW8zgCmIT06Dfgl6rjETcGHuctq42y5Phx40uS5Bxn7Feb8r8g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LVWMfQgedmRPQMZoK+rJBLHS1HmKhTy2MhUpz6MM3PPg4yOm7n60n6Te4vAs2/WoFg8Qz8VBKNKwAdyP9HEx4mY3Cre1gUf1dLQTOlGnPOdVFndZbZwt1+HXQ3XTfD3UeuxfD+Vhx/cQtPbZQNsLbkdRjwtRVGED3Yu4/YTTTb5wOHvRNgH0Hst+9GqzlqgTPyfea9GoR3ayj0Ahkdtp/ZcZ/oa1hyzksZGpSHlOMGWjXnFTJ3mtoseiXagWD5DMBajneyOaktkF/Bv4EfqLEVt4VEtHO6UTfj2ddl5V5q43Y/44rg9Fb/fYinR1Cwr2aGf2xKO9adppwE/RKGs3crD3o32UB8SUA03XPwH8LpBWtE0ABb70kc8IziFH+GGzSbve/x/guBAcD/Zw3BULP4w+/N7DInEx+YzeHHLGOrKFFO/LcFwIjgd7OO6KxQg0gry3Q+2NRBusl3SoPQcHBweHfRSnohfltvNnlGlxFJq6HduBthwcHBwcHBwcHBwcHBwcHBwcHBwGN/4LeWHK/X7v+rAAAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle 1 + x + \\frac{x^{2}}{2} + \\frac{x^{3}}{6} + \\frac{x^{4}}{24} + \\frac{x^{5}}{120} + O\\left(x^{6}\\right)$"
      ],
      "text/plain": [
       "         2    3    4     5        \n",
       "        x    x    x     x     ⎛ 6⎞\n",
       "1 + x + ── + ── + ── + ─── + O⎝x ⎠\n",
       "        2    6    24   120        "
      ]
     },
     "execution_count": 156,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.exp(x).series()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 157,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAATsAAAAYCAYAAACFk1rrAAAABHNCSVQICAgIfAhkiAAABqZJREFUeJztnHuIVFUcxz+jsWlWShRU9NJ0K/FRaE+SxgdEWihZfywWHBPpDy16/JNGJfRwKQWxMpCgMUMTVAIjQkyXyrJ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ga+QHGDqQqXCcDEPe+HkZWRd0OBwOh8PhcDgcDocji/wH37PAk7v5SpIAAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle 1 - x + x^{2} - x^{3} + x^{4} - x^{5} + O\\left(x^{6}\\right)$"
      ],
      "text/plain": [
       "         2    3    4    5    ⎛ 6⎞\n",
       "1 - x + x  - x  + x  - x  + O⎝x ⎠"
      ]
     },
     "execution_count": 157,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(1/(1+x)).series()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 158,
   "metadata": {},
   "outputs": [],
   "source": [
    "expr = sympy.cos(x) / (1 + sympy.sin(x * y))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 159,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAdYAAAAaCAYAAAAKR30hAAAABHNCSVQICAgIfAhkiAAAC19JREFUeJztnX2wFlUdxz/38hIEiYVJWpmlYmaKpWaa4ANWTlpZWlNok1uYNWmlWaM4Md6ZUl7UMig1bPT6Ug0B0hthF6oL6VRCo0lCU0FPUaJhXpLyhvfK0x+/sz179+7ZPbt7dve5D+cz88y9z+55+Z2z37Pn/TzgcDgcDofD0cbMBTYCzwC7gB8Cr0/wMwF4ZQXxtiOvrdqADFwKPIo8u2eAXwLnJPixoZkqyJJWRzwjUfNlcg3QAL5WtSGO7PwE+AhSqR0HrAKeAF6icd8JXAeMKTneduV44KKqjUjJucDZwFHAVEQPA0haorClmSpIm1ZHMiNR82XxZuDPwG9xFWtbMRF4HniX5v5c4LQK4m1nvgicULUROXka+LjmXlGaqYq4tDrMaAfNA9wN/AMZkcnLJGAbMAvoZXjFeiLSk52TFND7gCXAL5BhlgZwrwUDHdk5BHkOb4m4NxlYW0G8RZNVh1OQxsBi9X0ycDHS+/4T0A/8C3gAKQydmnAOAX6U0faqGQXMBp5DRh7CFKkZgDryvKI+T1iOKymtPmFd+EwHVgI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8YPnSdxDDL0fngJcVWC/3uEfcB3iV5Z1s5MRh7u/p4PNjixagNKwtdMVTitCq2QD/uL5h0Oh8PhcDgcDofD4XA4HA6Hw+FwOBwOh8PRgvwPJSXk42m/V/8AAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle 1 - x y + x^{2} \\left(y^{2} - \\frac{1}{2}\\right) + x^{3} \\left(- \\frac{5 y^{3}}{6} + \\frac{y}{2}\\right) + O\\left(x^{4}\\right)$"
      ],
      "text/plain": [
       "                           ⎛     3    ⎞        \n",
       "           2 ⎛ 2   1⎞    3 ⎜  5⋅y    y⎟    ⎛ 4⎞\n",
       "1 - x⋅y + x ⋅⎜y  - ─⎟ + x ⋅⎜- ──── + ─⎟ + O⎝x ⎠\n",
       "             ⎝     2⎠      ⎝   6     2⎠        "
      ]
     },
     "execution_count": 159,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expr.series(x, n=4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 160,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAh0AAAAaCAYAAAAT+u52AAAABHNCSVQICAgIfAhkiAAAC7pJREFUeJztnXuwVVUdxz+XVxAmKCppRpZ4TU3QfIXvR2VlaflKtKljhDVGD7SHWI7OpPJQekAJAeVFnRwCxB4EAeaFciqRyVS0qeFyjQCRBBKTrhc9/fFbe86++6x99lr7rnU5+571mTlz71l77d9eZ/++e5/fXuu31oFAIBAIBAKBQCBQCCYBa4GXge3Ar4D31LHdQP3wReApxMcvA38ELqpju4FiMxh4u0N7NwNl4IeJ8nc7PEYgEEjwW+BaJCA4HlgCvAAcWKd2A/XDJcBHgKOAZuAOoBMYVad2A8WlD6KD/o7svQ/YCPyV6qBjFPAZR8fpMe4DXkQis7ychERh45y0KJBF8JmwH/A68LGC2HVN0EH32AF8vkB2XRK0449JwOmObA0BNgDnA61UBx0A3wFOcHQ875wMvAHc4MDWEmArcsMO+CP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SGT5Eu6eUHuKXyJPHqfs64ZY0Og+s6GI/jUl6MAfvVk30DPaiaaHZq3s2dt4G9WJs3F8aGsYsgpuIRiIZELXyrg1YRASsS/qdot6jiiRp9ZiK/VII/vMhqL615SgAz/0dt1Az2jnOcynzPc27kDfY+RLW5OAMxzb9MrZyIqAaWvxm3AMMjZ7hIP2+GQEMg1rLjKu+gxuFqLqaRrJZzb0Fv+aEnTghkbTDQTt+KQ/sjx+H/xr60iktylQp0Q/jLQTSeTSZSgHikvwbyAPQTcB1wxDgjHf2jrJsb1AIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBgEf+D1XTp/r/q0deAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle \\cos{\\left(x \\right)} - x y \\cos{\\left(x \\right)} + x^{2} y^{2} \\cos{\\left(x \\right)} - \\frac{5 x^{3} y^{3} \\cos{\\left(x \\right)}}{6} + O\\left(y^{4}\\right)$"
      ],
      "text/plain": [
       "                                        3  3               \n",
       "                       2  2          5⋅x ⋅y ⋅cos(x)    ⎛ 4⎞\n",
       "cos(x) - x⋅y⋅cos(x) + x ⋅y ⋅cos(x) - ────────────── + O⎝y ⎠\n",
       "                                           6               "
      ]
     },
     "execution_count": 160,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expr.series(y, n=4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 161,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAA+0AAAAaCAYAAADCOL0vAAAABHNCSVQICAgIfAhkiAAAD2ZJREFUeJztnXmsJEUdxz8LC3LLJQgBOQ0oIF4IGo4BMQSMB4dRiEcnHGoQOQ1gRCZG2eW+VlzQwHgiArJeWeTyASLERUBBFtRlR5FdVpAFuQQWn3/8qnn9+nX3VHVX9XTP+32SyXvT0/3r6t+36ldHV1eDoiiKoiiKoiiKoijKkOgC46nP4y2wrVSnSxh9jgb+BPzHfO4EPujB7nSgi5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h2QDhsiypUZ1+toY5kp0vE4pA65GVlccxZwOVJmxpHrrPOduW30L+T7OGR8iSiX50P6uI6Y0WW4nfYuzapjod6YUaY9akNE8/JzjK1/NQ5MJkSsDUnbY6MvqvjBp+YR1Trtrv0Br6yP3MFdjExX+DfwM2C3nP27TDgu69M3+22LvOpnOdkvvd/X7H9XxfTvYez8HphR0dYuxtYJBft0sbt+2/3HyX6VyebAFUjmfhl5jciFDG90aS/gSuAhpNC9gox23YgUptj3bdQdBmvfpR7dQ1CXJjBYl6p+dvFbbGsYnfb43DbX0cYyM0jHHYFvIou6PIk0Gp5BKuYu9Y74t9G/UOzjLuHiS4R7ng/p47piRmxnWJ2AptWxUH/7yrU9akNEs/JzEhv/ahyYiu9YG5JRiI0+qOoHn5pHVOu0d3HrDygJfo5MDdnFg634tQJbebClhMWn7qDa+2KQLurn4aGxMiwak8KgfhgeGjPCYuNf9dtUfMfatjKd8oZqPgLECxLM8WRvIQ1e7l95Dd+6g2rvAxtd1M/DQWNlWDQmhUP9MBw0ZoTF1r/qt8mEiLVtZbrkDdW8xbwJee3Ht4GXgAeANYaaIqUOVPdmoro0F9UmLOpfZdTQPB0W9W851G/TD9V8RDgKGXFZDvwE2HS4yVFqQnVvJqpLc1FtwqL+VUYNzdNhUf+WQ/02/VDNFUVRFEVRFEVRFEVRFEVRFEVRFEVRFEVRFEVRFEVRFEVRFEVRFEVRFEVRFEVRFKWA/wNjWyHZznHnkwAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle - \\frac{61 x^{5} y^{5}}{120} + \\frac{5 x^{5} y^{3}}{12} - \\frac{x^{5} y}{24} + \\frac{2 x^{4} y^{4}}{3} - \\frac{x^{4} y^{2}}{2} + \\frac{x^{4}}{24} - \\frac{5 x^{3} y^{3}}{6} + \\frac{x^{3} y}{2} + x^{2} y^{2} - \\frac{x^{2}}{2} - x y + 1$"
      ],
      "text/plain": [
       "      5  5      5  3    5        4  4    4  2    4      3  3    3             \n",
       "  61⋅x ⋅y    5⋅x ⋅y    x ⋅y   2⋅x ⋅y    x ⋅y    x    5⋅x ⋅y    x ⋅y    2  2   \n",
       "- ──────── + ─────── - ──── + ─────── - ───── + ── - ─────── + ──── + x ⋅y  - \n",
       "    120         12      24       3        2     24      6       2             \n",
       "\n",
       " 2          \n",
       "x           \n",
       "── - x⋅y + 1\n",
       "2           "
      ]
     },
     "execution_count": 161,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expr.series(y).removeO().series(x).removeO().expand()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Limits"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 162,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAA0AAAASCAYAAACAa1QyAAAABHNCSVQICAgIfAhkiAAAAHZJREFUKJFjYKACCGFgYJjMwMBwmIGB4RMDA8N/BgaGJYQ0XYAq/MzAwHCdWE2ODAwMqgwMDIwMDAwOuDSxoPH3EzKVgYGBgYkYRaOaBlwTeuQGQDEDAwODBJS2ZGBgWABlv2FgYChBN6SBAZJ0cOEH5LiMzgAA6XoX52TB9a4AAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle 1$"
      ],
      "text/plain": [
       "1"
      ]
     },
     "execution_count": 162,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.limit(sympy.sin(x) / x, x, 0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 163,
   "metadata": {},
   "outputs": [],
   "source": [
    "f = sympy.Function('f')\n",
    "x, h = sympy.symbols(\"x, h\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 164,
   "metadata": {},
   "outputs": [],
   "source": [
    "diff_limit = (f(x + h) - f(x))/h"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 165,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAEoAAAAVCAYA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hpirqMAAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle - \\sin{\\left(x \\right)}$"
      ],
      "text/plain": [
       "-sin(x)"
      ]
     },
     "execution_count": 165,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.limit(diff_limit.subs(f, sympy.cos), h, 0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 166,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAD4AAAAVCAYAAAAeql2xAAAABHNCSVQICAgIfAhkiAAAAzhJREFUWIXt10+IllUUBvDfOGWahQYZFVaLpqEMsiiEonYuykVEheQm+oMSZYtcBNo6K0taRBhlIG3KGslwIwOh/QNTpwL7s6gsA51KMkPKRh2nxTkfvr3ffeez/IyBfDYz73me+9z73nPPue/HaUw4vIafMe0kPK7HGB7syor+A9yAY1jaBa+3MYxzuuB1yjGIA5jaBa+5IuvLu+B1StEvsv1yFz2/wm70tgKTCqK5WIc9GBHHZBALaroFeB+/4RB2YhnOapj8drybfiPYi/fwcE33AHpyDSUMigzeWYv3YG1yT9e4N3Ap5jV4WoSjubC3sAJr8Bm2VHQrcoJ9WI1n8XnGtuDMmu/i5IZFJlu+27C9pt2Ra2hqanMwii9VMohVOUfppMxL7rmS4WwcwX5cXeBn5d8b0+QHXFjhz8BG5XoaEpt5QcH3/Mr/08RL7ywtsIK1Oc99+bw8n9cpn+LpyW8rmb2Q5GMdJn0ldYsLXL/Ixq5afAi/47wO3v3pPdhBN0uU1/dYkmM2YfI4Yw7hxxKxPQ2u7DDpUOr6Gvjdyc+oxJZmbC+exx2YWRjbOk1N9V3FU6kdw0c4u4N+jzhNbfg6Tc7tYPBN6ppqcGvyl9Xi9yY3mvwxbBZ3dgvXJvdOhzVwfDNPJFlECR8sEf8045c38KWMVzED80XJjOIXx2v/4hz7YYc1LBQbN5z61R30k1L/bYk80Rpfo/kzsE+5xpvwanrdlc894jN13zhj5uOwaIAzxR19xPgJuyrnWV8iq119doFvdfWb0uQ7f6/TXmxI7ona2FtF16+jdQvcVokNaO4hN+MPsbEXZezu1G8o6Fu4PzVLmgSLRMZG8CaexEvibt1c0T2TRj/hRawUGRjDB9q76wHRUQfEXbpKXC1j6V299xdm/JGax5z0GdZeZq0yvaXhvV4Xje2SBh7RWdeLI3dYdOJNYmeruEfU4kH8iS9EpqcUPB8SPxZ2iYztx6d4XHsznSw26eNKrC9jv+Kagn/rA2VrgZsurrLxTsSEwTLxItd1wetR45+GCYUp4nbYeJI+U8WJHagTve3aCYGj+ET84Nkhmu6/wRWiX60U/eE0/rf4C2Yx6aXXHhECAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle \\cos{\\left(x \\right)}$"
      ],
      "text/plain": [
       "cos(x)"
      ]
     },
     "execution_count": 166,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.limit(diff_limit.subs(f, sympy.sin), h, 0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 167,
   "metadata": {},
   "outputs": [],
   "source": [
    "expr = (x**2 - 3*x) / (2*x - 2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 168,
   "metadata": {},
   "outputs": [],
   "source": [
    "p = sympy.limit(expr/x, x, oo)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 169,
   "metadata": {},
   "outputs": [],
   "source": [
    "q = sympy.limit(expr - p*x, x, oo)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 170,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAGcAAAAVCAYAAABbq/AzAAAABHNCSVQICAgIfAhkiAAAAwlJREFUaIHt2U+I1VUUwPFPOsgMBioTKARRUEngorBEFw7aHw1CyGprBYUEkUQJYiBKixQ3Ue1aVETtrCmi0gSLtCgimkU0LpLGFo5NYlmE/X8tzv0xP58z711nrvqezRce993zO++cw7l/fufexwxdx6sYw9yLHcj/gKVo4KEc5ZvxL55okt+HF3AQvySDr2UGsBD/4PnU78fDGMS3OI1TOJSCnJVptxOZSp4GMYrL2xn/AD+jr0k+lBz9iuFMpxUbk/7q1H8k9Y/hdezES8lvA3twWabtTmMqeVqW9J5qpXS9WDUvTvBsNa4TSVuV6bTifZzA7NS/FeucvUIW4ftk+95M253GVPM0jKPGc3QWu5Kx29oYOhen8/AHXs7QJWZPQ2wN3c4q+XnannTXVoLmmXu7eDd8Vig4uAtz8Gam/l+p/btgDN3AJ6m9oxLUB2cubhTL67eCTtcne/szdHtwf/q+t2AM3cAXqR2oBPXBuVLsd6MFHfbiTvHO+T1DfxeW4D3sKxhHN3BK5OiqSlAfnP7U/lTQ4RpRHg5m6G7CkziMDQVjaMWI2OdzP7kF0FQ5iSuqTk/twenU9hZ0th5/4t02eo/iOXwjipGTBWNoxRF5K7ri2PkKJNFnfBzOGJyx1PYrw2xRLh8QS3YyHsez+FoMzFgL3dK0q0ovJLMwH9/VBRWj+BGLCzkbEAPdakvbIgZmSJwPLuTAdBqLxdloqBLUB6eBj8Wed20BZ/eIA+3bkzzfJgqAL8UMPtHG3ispxgcLxNaJLE/th5Wgp0nhDXEyXyvuvOrcnT7ESR5WiKQRyd3cpP8pfpggkAfwtDhTHRTFQDMjNduMT6ROP/+ca54q1oh8TDaZzcFxfD7Bsx1aVzIjNd1bkqz58jTXVgMfNf3mK3GRuGCy4DuEHfLzVDFPFAJvtTO+NRm5aRoBPpNsXDMNG3Xmi1m1u5C9TuMxka+V7RR7xQXcO9NwNqz2YivAOlHyLmqn2IX0iRJ9T+4PBsRF3MyfbeefG8RWePXFDWOGGS4V/gNUocsCuQgpIgAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle \\left( \\frac{1}{2}, \\  -1\\right)$"
      ],
      "text/plain": [
       "(1/2, -1)"
      ]
     },
     "execution_count": 170,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "p, q"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Sums and products"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 171,
   "metadata": {},
   "outputs": [],
   "source": [
    "n = sympy.symbols(\"n\", integer=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 172,
   "metadata": {},
   "outputs": [],
   "source": [
    "x = sympy.Sum(1/(n**2), (n, 1, oo))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 173,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAADYAAAA4CAYAAAC2TwutAAAABHNCSVQICAgIfAhkiAAAA2pJREFUaIHt2l+opVMYx/HP1pgZY4vmRE3MOP7UuMA5I38idNIxLhSS1ChJrpQbmbngQudeJKUmpYQoyQUyXIjRaC4oQwYTJs04KOMkf8ohc1w8e/euc9rOfvd+17tfaX9r1V7vXn+eX2u9z1rrWS9jejKHQ3gRp+J6fID3cHlzZlVjFrvRxk68jY9xIc7D3uZMq8YuXJnk9+GeJP8UTh+pRQknVKh7CDd2fl+HdXgAZ+IUXICfKlnXEC08ie/wIc7GbTiCw7ipOdPGjBkzZkhaJctdghcy9LddeM3aWVOy3AZszdDf2gxtlKLsAr1YqxUN8ziWOuk47mjWnHy08LxC3J+4oVGLMnIi9ijE/YYrGrUoIxuwXyHumNjw/i/YiIMKcUdwVk19XYvXxGZ7SWy0+zLssWXB8jVpM94SgnNzsjjA3ldD2//KVvyoGLn9YqrWRekRy8Fl+FUh7g3lF/5BGakwIv6xqBD3nPLbtUEYuTC4HX8rxD1WQx+1O49e7ME3SX4W6zO23whr8KZitI6qx/2PfCo+rRD1s4gt5qKN6U5aEjHMaWzJ2EdP5hSiFjGTuf2ZpP00PZO5n2XcnXR0HDvq7GxUbMdfCmG7mjUnD9P4RSHqiWbNycMWzCtEvSLvstEIp+FThaj35V2rejmJYVNp1uKdpOIXmKgsZTg24118Jnb+tw7bUEuE37qifsA51e0bmk2Y6vw+Q2wIhjpVPCjP9JgbSkZ/PrFiwS770k/1L9IYl4pYzNH0Ydlz07y46KvKsQxtpEzgWXGTOpDDaIJJYeQtItzwO74Wt6Yp68Ql/p2jNK4KNwthe8XR53y8io+SMi3xpcLcqI2rwsNiV7MpeXYXvk3yV4u96YEkXZQ2UldsogpTeB3fJ8/OxVdJfp8+jq+JrVC/OOGUiHalbLN8KvalCWGrxQnbYnRWihhYWMqkct4oJytH7CoREGonzyY65Za9Q/1IR6y7CN+PRzr5g3i0R72HxIXEaumaQQxJbPiyU7/LNnEy/3yI9lDOG3XZKNzwaumkEn3WFpxJvWIZb9RloZP+s6ycimW9UV1TMRvdEVvNG73co95uvNSn7flqplWjK+xiMd8PJP9NiKBnrxGrMhXb4h3sMiliKAtq+FTiXnEiTpnFH/LvTmY0ECccM2ZMXv4BUvcBz2LWVEwAAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle \\sum_{n=1}^{\\infty} \\frac{1}{n^{2}}$"
      ],
      "text/plain": [
       "  ∞     \n",
       " ____   \n",
       " ╲      \n",
       "  ╲   1 \n",
       "   ╲  ──\n",
       "   ╱   2\n",
       "  ╱   n \n",
       " ╱      \n",
       " ‾‾‾‾   \n",
       "n = 1   "
      ]
     },
     "execution_count": 173,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 174,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAACsAAAAYCAYAAABjswTDAAAABHNCSVQICAgIfAhkiAAAAmZJREFUWIXt1lnojmkYBvCffekvIcuBlKJkyZa1TCEpMkUj5UxKOSQpJVGibAcS5UTORoZpkmwlZqYUB2PJLpQDZBtjMGM/uJ+P1+Nb+PyRuOrr+bru5bme+37v5335RrAIx/APbmEX+n9RRVWwD7OEwAH4FTfQ8UuKel804DmmfKoNmjZirnYp390qPl3FgdaXsY3BDlzH/2ndj0mNqPE1tuEvNKviMwcvMTbjFyf+FrZgBTaLmVjV2EJXi0r0quG3B7e9faDpSegB0Z0cLcolmpyC3uc3qBC3FjfRt4bQ9qK9WwpcU1zGQ3SuEa954f99bMJcnMYvBVsfzMCfogInE78+8WNxpsZek9ESOwvcaPRMe91LPv3xH47iSLWEU0Xllmf8wsTPLnAbxR07Dt0Kv4YKubfjX7QucPNS3g2iAHkHD6tS8WXJ6aeM/znxQwtcpUdkaZm8rfEgCS5iZYp5hosYLw7bD3uT7VAlsb8lh94ZfwFP0apSYA38mPLOzPhViX+OgZmtDa4l+yjevWcHiVZdKnANYsrPiQGpB1PxBLsz/l5aL+NEZnss3pIwPBfbAT28eXZKGIwmOF6n0GbirXZQDHER59P6d4XY0mHa5GJL11F+wiFprVfsD+gkvh1y/C6e197ipshR+jC6SnmxuahSwKk6hMI0vBDzkOO2ePO1x5LMNgETRTf25oFbRftHZPyOxM9D9zrEXsMfVexdxE3wUlR6jbg1nomhnl4u6LiYyrYZP0NU4BEWfKDQYUnE/Bp+HbEOV8Qg3hGdGPmB+30UVgixPT/npvXirPoH8zu+46vHK8fooVfyCVxFAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle \\frac{\\pi^{2}}{6}$"
      ],
      "text/plain": [
       " 2\n",
       "π \n",
       "──\n",
       "6 "
      ]
     },
     "execution_count": 174,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x.doit()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 175,
   "metadata": {},
   "outputs": [],
   "source": [
    "x = sympy.Product(n, (n, 1, 7))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 176,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAADEAAAA6CAYAAAAZW7HfAAAABHNCSVQICAgIfAhkiAAAAmxJREFUaIHt2s+LTlEcx/GXya8ys5KSlEljamoyPywkjSYN25EkW0vlL5iVjVjaKEs2FmKDFLtJsWAMk6KMDIVIExlCxOI8t7lzu8Yzz73TPeW+63TqfM+P7+eec57z66HGDH7nhLMV+rRkNmBjKowIIoYr9KkwZzCNFVU70iqr8QFjVTtShMP4iU1VO1KEm7hWtRNF2IJfGK3akSKcwFusrNiPlmnDS5yu2pEi7BfWhu6qHampqYgZ+Zu+pYT+Mh1qK7Oyqij6u/4OH5vItwpbC7ZVKjPmh8XxJst0qofT4tQiYqEWEQu1iFioRcRCrCL2CSv7KfTiorDFmcMd7ExnjlXEQCPuxj204wLGsQtX0ZFkjvVgP9iIh7AbD1K2Kzgo7L9uE39PHLVQADxpxGuThBhFtKMLr3Ajx55s6Z8nCTGK6Bf8uiVM7iyD+IQXSUKMIpL5MJFj68A2TEoJjFFEMh/u/8XWJiMwRhGD+IGpHNuORrxgsscmYg168FgQkiUREXVP9AqXCnlDiSBiDs/SibEtdhMWfyrryUtsRcSU8KwF75ss893CIfC1hXZramoiZo/wyvpG2DocKlphFevEOjzS/D3ukugUvswB4U36i7Dd3bscjTUopSfSjDYqHRf+aNIlHAMnc/KOCSvnYmGoiTZLEZFe7PrwGUeEN2nCUfBkTrlzuPSPul8Xda5ZsiKumxdAOEVN55SbbYQoSE/sPtzN2Acs73AqhaQn2oWvnnV4AJdzykU5nLYLk+xhyrYem+X3RJHhlFwEJHQK5+pZ4XKgZY7haSZtBN+Uv10flv8sfL7kdmpq/lv+ADkQlxIfaWuLAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle \\prod_{n=1}^{7} n$"
      ],
      "text/plain": [
       "  7    \n",
       "─┬─┬─  \n",
       " │ │  n\n",
       " │ │   \n",
       "n = 1  "
      ]
     },
     "execution_count": 176,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 177,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAADQAAAASCAYAAAAUjf3AAAAABHNCSVQICAgIfAhkiAAAAjJJREFUSInt1s+LTmEUB/APJsrMGD9KFiYyoUkSi4nUTCjZ2iMLCxvNwk5hLIREpETCwsLGgoUmP6Lk1x9gwUx4WfiZMqExlNfieS7Xde/rvq+x0XzrdrrnOed8n/Pc85xz+c9RQbXgeVXgMxtn8AIjMcYRTCvJuTHFsaWGXSmephzHoWiYxcccXQfuYiYu4SG60It1WIl3NTbZjmMxdksNu4Z5KvEpiyvCyW7L6A9H/YkavuNwHY9xUO0v1DBPRfmE5sVgTzE+s9YqnPonNBf49+IbutGnOKG6eLIGMAkbsCOSrsKEHLvVUV6NG0vjA+5gMpbn+HZiP47iVs56wzx5Cc3COewV7tINDKInY7cwyoGCjQxGuSCjb4rxnwuH9ifUxZNN6CzWCEk1YzFOYi76sSRl2xblUAFRop+a0e/CUmzGcIFvGnXxZLvcnsz7A2wV6nS7UOvrS2yCcOkJ9Z+gS/gqh3CvZJy6ePJKLg9JF+lO6ZKTaZOPKRm7pNQGsLMkb908ZRN6E2W6Yz2KMntHEsyPMqn9lmjbic9+Hdq7o82p+J6eg3Xx5A3WPKyI8klKdzPKtcLBpDtQqzDshnE/6kZwuiD+MuFe3RYSSJdjvTw/sAjTc8jmCJ2k6veu9DeDNY0+/2Cw9gml0I/jOIALQvZVXMbEjE8HXsf1i9gntPmqcNIzRimhhnh6cF74T3qPr3iLa9jkZzfJol1o9y/xBc+EgZn3tRtNaLR4xjCG0cZ3Joay/nl8oi4AAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle 5040$"
      ],
      "text/plain": [
       "5040"
      ]
     },
     "execution_count": 177,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x.doit()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 178,
   "metadata": {},
   "outputs": [],
   "source": [
    "x = sympy.Symbol(\"x\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 179,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAADwAAAAUCAYAAADRA14pAAAABHNCSVQICAgIfAhkiAAAAchJREFUWIXt1j1oFEEYxvHfJQrWoiAIphALRUyhYqN4KpyWolEQBLGxs0sh2qSzVRRErAQlECzSiI0gaGJlIbEQCUoQFJUgYiB+YixmDjZhb+/Wvb1FuD8sczv7zLzPuzez79AnFyfwA0OJvquYxfpKHJVMDc9wK96P4iM299jHCK7hCb5iCXfKCtbAL1yIwXaVFSiD50KSC3ip5IThKX7jSJlBMjiALcKKq8tIeKDFBMfxAPP4KezJixhM0R7EcJzrUwHTRXgkeFzKO3AQ43HgLG7gCl7Fvtsr9MP4gjOYFF5S1dTlWNLXo/gyViX6V2M6PtsW+4bwDpfi/Q78wb6ijgtS12HCewTDky2en4sTncVa4eNwc4VmAlP/aLRb1GUknPwXzwubfhFjKdrtsa3hM7amaE52YGjO8rrdjrs4nUOfSTLhRmxPtRnztmDM1/ieQ/++YLxlNBNeI5yMHmN/NwOkcKjk+TNplqVabNdVZaRXNBP+hhnhC3yshXav9Dr8X1FL/G7gvrDMHwovYAAbsVMoTZt6bbBDjsYLNuAw3ghna8IBajRt4G7cwwfhfDyPF0L5qXTvtWFMKEWtrrmqjPXp06e7/AXZI12IXzL1WgAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle e^{x} - 1$"
      ],
      "text/plain": [
       " x    \n",
       "ℯ  - 1"
      ]
     },
     "execution_count": 179,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.Sum((x)**n/(sympy.factorial(n)), (n, 1, oo)).doit().simplify()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Equations"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 180,
   "metadata": {},
   "outputs": [],
   "source": [
    "x = sympy.symbols(\"x\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 181,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAEsAAAAVCAYAAAAOyhNtAAAABHNCSVQICAgIfAhkiAAAAgVJREFUWIXt2L1rFEEYx/GPYmGh+ELQIIggRCwCitgIQk5sbAIilhZp/A/yB5xFIGrpSyki2tgo2Nh5WoggGLFQUYSzUBQTRAUVUWIxG26ju5tdz9m94r4w7NvMPr99ZvZ5ZoYh/0QLi6nyvFE1zTFiuR8Wlx6syah8Fx3MRxByGvuxKxH1Da9xE+exEMEmHMcE9mIP1uMaTmTU/YpTyfkUdmS9sCV4sf1fZS7nBx7gEmZxDg8Tu2+wPZLdx4mNL3iWnF8t0a4jNbLStMR31tqc+zOJ7YuR7B7CGFbpfWdlZ62OIKyI7zn3ryfHsUh27+ClnFFSlrqdlcdkcnzSqIoVyArwdTCNddggBPyDgqNmG9JTiiadtTV1fVvIPB8aUVOSKr9h19/zj6JSFEBHhWA7imPYiTnsq6S+ZqqMrFfyA3QWb0vUeY8beIQXuILxCjZqpYqzDkdTESamT4VJ44g4E+K+GZRsCNuS469GVRRQp7N2CzEqS8MMtuA+Pv7x/LIQA6ciaitFndnwCM7inhD/FoSMOCEE+Hc4mdFuqUN/9mH7aFLoddgBoSMIv/10lRe2xF3ujOOCsE6bFz7+k7A2bGNzTrs5fMamPmy3FWfubk67jgbXhlXZKMSwMw3Z71jBWYO0nzUpTFeyYl0sSu1ndfX2cRiM9H1L/k5FLNL7WUOG1MBvozWCU5pp7VAAAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle \\left[ -3, \\  1\\right]$"
      ],
      "text/plain": [
       "[-3, 1]"
      ]
     },
     "execution_count": 181,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.solve(x**2 + 2*x - 3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 182,
   "metadata": {},
   "outputs": [],
   "source": [
    "a, b, c = sympy.symbols(\"a, b, c\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 183,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAeYAAAAgCAYAAADHVdvSAAAABHNC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+PVI8uQOtOpLlEUAiuI0tDrO8cDHUY/5fLN/P8MX5V+LBPZp5PgyFwl9KyrnPDkUVd7NwBeRcM4x5+5HTkjrLd3rnWgVpLBpFCcjj87tPuc+zNBUlw34G5UBhrxUd6CFC+Yg56J1qEd/PBr/2ovGsLzjjY3evs3VsrLEax+ctu1SVn3nqW1Ip++8tB2JGtHemBsk+QQSxJvMva9Fi8ffjiaT70I9ju4Ucdex98Y8Bi3P5ig/rervkajenB9wvofWU0fWe66ZhByLdqApGhuRU8gME97vS1Qf0sHEFultNxr5m6W2wZ6+nbarRRp995CPtmtY/JTtcHQCjdWSDiwwDRNQr907z9XhcKSjHfRdI0KbOxUtCr4RfVa6IfNkORzty6PEm06XBfPQ5y+/1YQcDkdyitT3YtTGrkNt7sKC0uFwOBwOh8PhcDgcDofD4XA4HA6Hw+FwOByOEvM//f1Nr7gtligAAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle \\left[ \\frac{- b + \\sqrt{- 4 a c + b^{2}}}{2 a}, \\  - \\frac{b + \\sqrt{- 4 a c + b^{2}}}{2 a}\\right]$"
      ],
      "text/plain": [
       "⎡        _____________   ⎛       _____________⎞ ⎤\n",
       "⎢       ╱           2    ⎜      ╱           2 ⎟ ⎥\n",
       "⎢-b + ╲╱  -4⋅a⋅c + b    -⎝b + ╲╱  -4⋅a⋅c + b  ⎠ ⎥\n",
       "⎢─────────────────────, ────────────────────────⎥\n",
       "⎣         2⋅a                     2⋅a           ⎦"
      ]
     },
     "execution_count": 183,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.solve(a * x**2 + b * x + c, x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 184,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAH4AAAAVCAYAAACAEFoRAAAABHNCSVQICAgIfAhkiAAAA21JREFUaIHt2UuIXEUUBuDPZJAIAaNGEsQsFIUEFeOArny0LkIgBExc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iE3BYOZxZRN1ZkHm+H6tPEOpBbP5Pn8XOYwxyOafwHQj5SEviCLgEAAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle \\left[ - \\frac{3 \\pi}{4}, \\  \\frac{\\pi}{4}\\right]$"
      ],
      "text/plain": [
       "⎡-3⋅π   π⎤\n",
       "⎢─────, ─⎥\n",
       "⎣  4    4⎦"
      ]
     },
     "execution_count": 184,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.solve(sympy.sin(x) - sympy.cos(x), x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 185,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAALkAAAAVCAYAAAAac0/JAAAABHNCSVQICAgIfAhkiAAACDZJREFUaIHtmn+MVcUVxz+A/CpYUKT+SrvQWqpERBbUmtr2bbWoISZatYmmlUiNmoqm1vozaUrbIIk1aaumAqkNqPgjLFBDTf3R0md/kIIISFtRq3X1D0VcQVBcFHa3f3zPeOfNztx337LLI/q+yct9d87MuWfunDnznTMXGmjgE4QS0O39nq+rNQcGvo/exax6G7KfcS+wFRhRb0M8TEVj8b2E/DAq/bc7VqlkgjIwB5jdtzZ+hFX2nK/2k/6+xG+RrZPraMMPzYaLg/KRVv5Kot2JZIN9eqLOJpNP8sqmAV323BAXAHcCfwN2Wtv7q/YADgc6gTvsfgxwGbACeAnoAHYAf0dOPDChZwXwBup7iE8hv50DtFHFyecUMLq3GAC8gzocM/RAwwY0AAfV0Yb70bh8KSL7ENiWaPcAmZN/KyI/y2SPBuVPoDEaHmmz0dq8C2ymuJNfbnVb7P5Ku38dWALMA35nz+0GWpGvhDjZ5LdUeV6ZOjr5BHvGc/34jL7CUOREa+psx2bkVLHo9hawN1LeBOwBXiVNt/5ssq97ZRNQFF+YsKUF+CJywBLFnfyPQDswyO6/AZxDzz4dAbxmes9P6NqM+jUoIYfAyVPLQn9hql2fKVj/YjTTX0QDvR14Grg0U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qRAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle \\left[ - \\operatorname{LambertW}{\\left(\\frac{1}{2} \\right)}\\right]$"
      ],
      "text/plain": [
       "[-LambertW(1/2)]"
      ]
     },
     "execution_count": 185,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.solve(sympy.exp(x) + 2 * x, x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 186,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAABMIAAAAZCAYAAADTwYJfAAAABHNCSVQICAgIfAhkiAAADqhJREFUeJztnXmwHEUdxz8vRCRyyiFIEeUSEgQRsaBAgYehUFAKFZRCUBaDlHLjhaDIgiBBwiEIIiXwuIqjQCgRRU4VsFCOgAgxFJjlCgTkRgIJ8vzj11O7mde9szM782Z28v1Ubb233b/u/r3d/s7v7W+7e0AIIYQQQgghhBBCiCWUO4DTgRllOyISaQKjscezZTqUgiOBu4FXgeeB64CNS/VIiPJpIk0LUReaSM9C1Ikm0rQQdaGJ9LwksS+W37oZ2BJgosfoE0ADeHTc3BL9MAcY7nj+v5L8SMswcDYm4iHgOGxibgS8WJ5bQpSONC1EfZCehagX0rQQ9UF6XnK4wP1sAe8NGY0C64+HN6JvmsA/y3YiJ5bDLj67lO2IECXSRJoWoi40kZ6FqBNNpGkh6kIT6XlJpAV8BmBCuX7UnhWAM7AXfCGWZDzC1V0EPAcs2+cY6wJPA3OBy4C1++yvLJbH5uOSnsXeHJsn08t2RIxhPPQM0nSdkJ6rjWJ070jPhjRdXRSj0yFNS89VRzG6d6Rno29NJ60I+xBwInAvtid1kft5M3AA8J6Y/U2M3X/7HHA78KWsTubAt50vX0mwWxc4AZiFTa63MEGOAJsmtL3OjXE9cDyWeZ4KfBx4x/nQDzsBuwGbADsAtwDPACv32W8ZXIG9xkuVMPbuwJnYnHwVe88uybH/tYDzgXm058/phJdlXoO9j8vl6EOIuugZetN0lfUM0nReF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CRootOf} {\\left(x^{5} - x^{2} + 1, 0\\right)}, \\  \\operatorname{CRootOf} {\\left(x^{5} - x^{2} + 1, 1\\right)}, \\  \\operatorname{CRootOf} {\\left(x^{5} - x^{2} + 1, 2\\right)}, \\  \\operatorname{CRootOf} {\\left(x^{5} - x^{2} + 1, 3\\right)}, \\  \\operatorname{CRootOf} {\\left(x^{5} - x^{2} + 1, 4\\right)}\\right]$"
      ],
      "text/plain": [
       "⎡       ⎛ 5    2       ⎞         ⎛ 5    2       ⎞         ⎛ 5    2       ⎞    \n",
       "⎣CRootOf⎝x  - x  + 1, 0⎠, CRootOf⎝x  - x  + 1, 1⎠, CRootOf⎝x  - x  + 1, 2⎠, CR\n",
       "\n",
       "     ⎛ 5    2       ⎞         ⎛ 5    2       ⎞⎤\n",
       "ootOf⎝x  - x  + 1, 3⎠, CRootOf⎝x  - x  + 1, 4⎠⎦"
      ]
     },
     "execution_count": 186,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.solve(x**5 - x**2 + 1, x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 187,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAA0AAAASCAYAAACAa1QyAAAABHNCSVQICAgIfAhkiAAAAHZJREFUKJFjYKACCGFgYJjMwMBwmIGB4RMDA8N/BgaGJYQ0XYAq/MzAwHCdWE2ODAwMqgwMDIwMDAwOuDSxoPH3EzKVgYGBgYkYRaOaBlwTeuQGQDEDAwODBJS2ZGBgWABlv2FgYChBN6SBAZJ0cOEH5LiMzgAA6XoX52TB9a4AAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle 1$"
      ],
      "text/plain": [
       "1"
      ]
     },
     "execution_count": 187,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "1 #s.solve(s.tan(x) - x, x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 188,
   "metadata": {},
   "outputs": [],
   "source": [
    "eq1 = x + 2 * y - 1\n",
    "eq2 = x - y + 1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 189,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAMgAAAAXCAYAAABOMABkAAAABHNCSVQICAgIfAhkiAAABhdJREFUeJztm2tsFUUUx3+lCIjEgqAgPgAFbZSoGPGRgG4NJCipiugHmygaFTEa1OKDGJXrA0sVEkN9YEzKTYQvanxiSlT0Ii0hilZFUg1qGp8lVrESQa1SP5zZ3NvLzs7sqy/3n2zu3Z0zZ87+53nOzEKKFCms4ABdBdcXBvkqYBvQAfwLnJGkcSlSBEAG6ATagFeBkwzyY+je9ru8hByVkFMF3Oqj8BTgALAXqAceBsZZmd5/cQVQB2wBfke4WmeZdywyiKxW97XAJuA7YD/wK9AMLANGx2dyr2A0cAPwCvAV8n4dQCNwPTDIkL+YKwjOlwOsADYi9fSBoczhSJvPAK0YOkjGoAzgFiW72EJ2oOAT5J33Ai0E6yALlXyFuv8bmX3rkYqsAz5UMj8Ax8Vmdc9jEfIePwLrgRrkPX9Tz18CSnzyF3MF0fj6CBnMR1janyOGDnK/kp1tWehAQAUwBalch2AdpAFoB0rV/TCN3HKl9+nQVvY+LgQqOXimGAd8i7zffJ/8xVxBNL7WKxnbQSdHQQcxTXc6uMZ3GuTeUoVdXvS8BMiqtBUhbehpvAfsQjO6+KAMaTRvIEsHgD81si+o3ymBrTNjCWL7Ek36ycBfwPsRy3kXedcDRc/bgDXqv6PJ68UVROPLbaOlPjJahO0gtrgLIeoRuhu4ElgAPAcs9cmfRSr12mTM6xHMBYYAL1vIVqrfzxKwo1H9nqtJr0PqyM/3zBKtPtzG+o8mPQhXkCxfAAwOmW+k+t1vkPsUeB7pDFcjBN8LVCO9f1HI8vsT5gF/AG97pN2JrI3LgLOAGUhlJzGrfozU1zkeaVciy+XVJNfYBgPXqP8bNTJ+XEE4vtzZpyyIsV5wsPNBSsg7PjaRq2ORiml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fyUGSKLoxiTSOZF00RDccjHeNE5KjHLqTh7OtNoxJGBnEDCu8f9JEfDtztoSMShgIXIWvHBxj4H0z1V7jfV+xBdpLH+4sPCDjAfcDNpF+6pkiRIkWKFClS9DX8B3OP899PVvuxAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle \\left[ \\left\\{ x : - \\frac{1}{3}, \\  y : \\frac{2}{3}\\right\\}\\right]$"
      ],
      "text/plain": [
       "[{x: -1/3, y: 2/3}]"
      ]
     },
     "execution_count": 189,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.solve([eq1, eq2], [x, y], dict=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 190,
   "metadata": {},
   "outputs": [],
   "source": [
    "eq1 = x**2 - y\n",
    "eq2 = y**2 - x"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 191,
   "metadata": {},
   "outputs": [],
   "source": [
    "sols = sympy.solve([eq1, eq2], [x, y], dict=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 192,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAABC8AAAAfCAYAAADHhOeDAAAABHNCSVQICAgIfAhkiAAAENhJREFUeJztnXewJUUVh78lZ1jJiIBkgWJBkgjqLEhQChFJBVXIWoQSUVQwAIo8lSwg7hJEFJ4BLYKKCoILWihBCoVdBGXFwFME3RJBQEWCPv84Pb7L7ISeO53mvfNV3bq7M/16Tvec07+5PR1AURRFURRFURRFURSlZ+wILABuBq4Hjo5rjqIoU4DFgZnAFrENGWBb4BWxjVCSYHtg5dhGKEpi7ANsFNkG1Q4lZVQ7FGVRbLTjOKQfYi7SLzGjLnEGjAOvc2CcoihKE68HfgYcSzoPfOsAZ8U2YpKyIqIxLj++WQa4CPmhpCiu6WNMgPww+xrwDWC5QNccRLVjatHHOFHtUHzSx5iAdtqRYdEvYZVIURTFARsATwBbRrZjkGnADcBqsQ2ZpBwI7BXbiC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left\\{ x : 0, \\  y : 0\\right\\}, \\  \\left\\{ x : 1, \\  y : 1\\right\\}, \\  \\left\\{ x : \\left(- \\frac{1}{2} - \\frac{\\sqrt{3} i}{2}\\right)^{2}, \\  y : - \\frac{1}{2} - \\frac{\\sqrt{3} i}{2}\\right\\}, \\  \\left\\{ x : \\left(- \\frac{1}{2} + \\frac{\\sqrt{3} i}{2}\\right)^{2}, \\  y : - \\frac{1}{2} + \\frac{\\sqrt{3} i}{2}\\right\\}\\right]$"
      ],
      "text/plain": [
       "⎡                            ⎧               2               ⎫  ⎧             \n",
       "⎢                            ⎪   ⎛  1   √3⋅ⅈ⎞        1   √3⋅ⅈ⎪  ⎪   ⎛  1   √3⋅\n",
       "⎢{x: 0, y: 0}, {x: 1, y: 1}, ⎨x: ⎜- ─ - ────⎟ , y: - ─ - ────⎬, ⎨x: ⎜- ─ + ───\n",
       "⎢                            ⎪   ⎝  2    2  ⎠        2    2  ⎪  ⎪   ⎝  2    2 \n",
       "⎣                            ⎩                               ⎭  ⎩             \n",
       "\n",
       "  2               ⎫⎤\n",
       "ⅈ⎞        1   √3⋅ⅈ⎪⎥\n",
       "─⎟ , y: - ─ + ────⎬⎥\n",
       " ⎠        2    2  ⎪⎥\n",
       "                  ⎭⎦"
      ]
     },
     "execution_count": 192,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sols"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 193,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[True, True, True, True]"
      ]
     },
     "execution_count": 193,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "[eq1.subs(sol).simplify() == 0 and eq2.subs(sol).simplify() == 0 for sol in sols]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Linear algebra"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 194,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}1\\\\2\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "⎡1⎤\n",
       "⎢ ⎥\n",
       "⎣2⎦"
      ]
     },
     "execution_count": 194,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.Matrix([1,2])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 195,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}1 & 2\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "[1  2]"
      ]
     },
     "execution_count": 195,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.Matrix([[1,2]])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 196,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}1 & 2\\\\3 & 4\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "⎡1  2⎤\n",
       "⎢    ⎥\n",
       "⎣3  4⎦"
      ]
     },
     "execution_count": 196,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.Matrix([[1, 2], [3, 4]])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 197,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}0 & 1 & 2 & 3\\\\10 & 11 & 12 & 13\\\\20 & 21 & 22 & 23\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "⎡0   1   2   3 ⎤\n",
       "⎢              ⎥\n",
       "⎢10  11  12  13⎥\n",
       "⎢              ⎥\n",
       "⎣20  21  22  23⎦"
      ]
     },
     "execution_count": 197,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.Matrix(3, 4, lambda m,n: 10 * m + n)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 198,
   "metadata": {},
   "outputs": [],
   "source": [
    "a, b, c, d = sympy.symbols(\"a, b, c, d\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 199,
   "metadata": {},
   "outputs": [],
   "source": [
    "M = sympy.Matrix([[a, b], [c, d]])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 200,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}a & b\\\\c & d\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "⎡a  b⎤\n",
       "⎢    ⎥\n",
       "⎣c  d⎦"
      ]
     },
     "execution_count": 200,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "M"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 201,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}a^{2} + b c & a b + b d\\\\a c + c d & b c + d^{2}\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "⎡ 2                  ⎤\n",
       "⎢a  + b⋅c   a⋅b + b⋅d⎥\n",
       "⎢                    ⎥\n",
       "⎢                  2 ⎥\n",
       "⎣a⋅c + c⋅d  b⋅c + d  ⎦"
      ]
     },
     "execution_count": 201,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "M * M"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 202,
   "metadata": {},
   "outputs": [],
   "source": [
    "x = sympy.Matrix(sympy.symbols(\"x_1, x_2\"))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 203,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}a x_{1} + b x_{2}\\\\c x_{1} + d x_{2}\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "⎡a⋅x₁ + b⋅x₂⎤\n",
       "⎢           ⎥\n",
       "⎣c⋅x₁ + d⋅x₂⎦"
      ]
     },
     "execution_count": 203,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "M * x"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 204,
   "metadata": {},
   "outputs": [],
   "source": [
    "p, q = sympy.symbols(\"p, q\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 205,
   "metadata": {},
   "outputs": [],
   "source": [
    "M = sympy.Matrix([[1, p], [q, 1]])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 206,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}1 & p\\\\q & 1\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "⎡1  p⎤\n",
       "⎢    ⎥\n",
       "⎣q  1⎦"
      ]
     },
     "execution_count": 206,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "M"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 207,
   "metadata": {},
   "outputs": [],
   "source": [
    "b = sympy.Matrix(sympy.symbols(\"b_1, b_2\"))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 208,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}b_{1}\\\\b_{2}\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "⎡b₁⎤\n",
       "⎢  ⎥\n",
       "⎣b₂⎦"
      ]
     },
     "execution_count": 208,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "b"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 209,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}\\frac{b_{1} \\left(- p q + 1\\right) - p \\left(- b_{1} q + b_{2}\\right)}{- p q + 1}\\\\\\frac{- b_{1} q + b_{2}}{- p q + 1}\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "⎡b₁⋅(-p⋅q + 1) - p⋅(-b₁⋅q + b₂)⎤\n",
       "⎢──────────────────────────────⎥\n",
       "⎢           -p⋅q + 1           ⎥\n",
       "⎢                              ⎥\n",
       "⎢          -b₁⋅q + b₂          ⎥\n",
       "⎢          ──────────          ⎥\n",
       "⎣           -p⋅q + 1           ⎦"
      ]
     },
     "execution_count": 209,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x = M.solve(b)\n",
    "x"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 210,
   "metadata": {},
   "outputs": [],
   "source": [
    "x = M.LUsolve(b)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 211,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}b_{1} - \\frac{p \\left(- b_{1} q + b_{2}\\right)}{- p q + 1}\\\\\\frac{- b_{1} q + b_{2}}{- p q + 1}\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "⎡     p⋅(-b₁⋅q + b₂)⎤\n",
       "⎢b₁ - ──────────────⎥\n",
       "⎢        -p⋅q + 1   ⎥\n",
       "⎢                   ⎥\n",
       "⎢    -b₁⋅q + b₂     ⎥\n",
       "⎢    ──────────     ⎥\n",
       "⎣     -p⋅q + 1      ⎦"
      ]
     },
     "execution_count": 211,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 212,
   "metadata": {},
   "outputs": [],
   "source": [
    "x = M.inv() * b"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 213,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}\\frac{b_{1}}{- p q + 1} - \\frac{b_{2} p}{- p q + 1}\\\\- \\frac{b_{1} q}{- p q + 1} + \\frac{b_{2}}{- p q + 1}\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "⎡    b₁        b₂⋅p   ⎤\n",
       "⎢ ──────── - ──────── ⎥\n",
       "⎢ -p⋅q + 1   -p⋅q + 1 ⎥\n",
       "⎢                     ⎥\n",
       "⎢    b₁⋅q        b₂   ⎥\n",
       "⎢- ──────── + ────────⎥\n",
       "⎣  -p⋅q + 1   -p⋅q + 1⎦"
      ]
     },
     "execution_count": 213,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Versions"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 214,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<table><tr><th>Software</th><th>Version</th></tr><tr><td>Python</td><td>3.6.8 64bit [GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)]</td></tr><tr><td>IPython</td><td>7.5.0</td></tr><tr><td>OS</td><td>Darwin 18.2.0 x86_64 i386 64bit</td></tr><tr><td>sympy</td><td>1.4</td></tr><tr><td>numpy</td><td>1.16.3</td></tr><tr><td colspan='2'>Mon May 06 14:25:08 2019 JST</td></tr></table>"
      ],
      "text/latex": [
       "\\begin{tabular}{|l|l|}\\hline\n",
       "{\\bf Software} & {\\bf Version} \\\\ \\hline\\hline\n",
       "Python & 3.6.8 64bit [GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE\\_401/final)] \\\\ \\hline\n",
       "IPython & 7.5.0 \\\\ \\hline\n",
       "OS & Darwin 18.2.0 x86\\_64 i386 64bit \\\\ \\hline\n",
       "sympy & 1.4 \\\\ \\hline\n",
       "numpy & 1.16.3 \\\\ \\hline\n",
       "\\hline \\multicolumn{2}{|l|}{Mon May 06 14:25:08 2019 JST} \\\\ \\hline\n",
       "\\end{tabular}\n"
      ],
      "text/plain": [
       "Software versions\n",
       "Python 3.6.8 64bit [GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)]\n",
       "IPython 7.5.0\n",
       "OS Darwin 18.2.0 x86_64 i386 64bit\n",
       "sympy 1.4\n",
       "numpy 1.16.3\n",
       "Mon May 06 14:25:08 2019 JST"
      ]
     },
     "execution_count": 214,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%reload_ext version_information\n",
    "%version_information sympy, numpy"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "py3.6",
   "language": "python",
   "name": "py3.6"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
